Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet-sdk-9.0.100-preview.3.24175.24] CS1061 error when building OrchardCore #39847

Closed
Junjun-zhao opened this issue Mar 28, 2024 · 5 comments
Labels
untriaged Request triage from a team member

Comments

@Junjun-zhao
Copy link
Member

Application Name: OrchardCore
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.3.24175.24
App Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2012346
Github Link: https://github.com/OrchardCMS/OrchardCore

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.4.24175.11 + default target .NET 8.0: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.3.24175.24 + default target .NET 8.0: Fail
  3. Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.3.24162.5 + default target .NET 8.0: Pass
  4. Windows10 21h2 x64 + dotnet-sdk-8.0.202 + default target .NET 8.0: Pass

Description:
CS1061 error shows when we build OrchardCore\src\OrchardCore.Modules\OrchardCore.Taxonomies project with dotnet-sdk-9.0.100-preview.3.24175.24

Repro steps
The machine has dotnet-sdk-9.0.100-preview.3.24175.24 installed

  1. Copy app source to local machine
  2. In Cmd, go to directory: OrchardCore\src\OrchardCore.Modules\OrchardCore.Taxonomies
  3. dotnet build

Expected Result: Build successfully.
Actual Result:

OrchardCore\src\OrchardCore.Modules\OrchardCore.Taxonomies\Controllers\AdminController.cs(145,56): error CS1061: 'JObject' does not contain a definition for 'Terms' and no accessible extension method 'Terms' accepting a first argument of type 'JObject' could be found (are you missing a using directive or an assembly reference?)

Minimal Repro steps (Demo attached):
ConsoleApp9.zip

The machine has dotnet-sdk-9.0.100-preview.3.24175.24 installed.

  1. Create 8.0 Console App.
  1. Install <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
  2. Add this code
 internal class Program
 {
     static void Main(string[] args)
     {
         ContentItem item = new ContentItem();
         var dat =  MyTest(item.As<ContentPart>().Content);
         var items = dat.MyProperty as JArray;
     }
     private static JObject MyTest(JObject content)
     {
         throw new NotImplementedException();
     }
 }
 public class ContentElement
 {
     public JObject Data { get; internal set; }
     public dynamic Content { get { return Data; } }
 }
 public class ContentPart : ContentElement
 {
 }
 public static class ContentItemExtensions
 {
      public static TPart As<TPart>(this ContentItem contentItem) where TPart : ContentPart => contentItem.Get<TPart>(typeof(TPart).Name);
 }
 public class ContentItem
 {
     internal TPart Get<TPart>(string name) where TPart : ContentPart
     {
         throw new NotImplementedException();
     }
 }
  1. Build source code with "dotnet build" using 9.0.100-preview.3.24175.24 SDK

Expected Result: Build successfully.
Actual Result:

error CS1061: 'JObject' does not contain a definition for 'MyProperty' and no accessible extension method 'MyProperty' accepting a first argument of type 'JObject' could be found (are you missing a using directive or an assembly reference?)

dotnet info:

C:\Users\v-gwei>dotnet --info
.NET SDK:
 Version:           9.0.100-preview.3.24175.24
 Commit:            09d6f381e6
 Workload version:  9.0.100-manifests.77bb7ba9
 MSBuild version:   17.10.0-preview-24175-03+89b42a486

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-preview.3.24175.24\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.3.24172.9
  Architecture: x64
  Commit:       9e6ba1f68c

.NET SDKs installed:
  9.0.100-preview.3.24175.24 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.3.24172.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.3.24172.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 9.0.0-preview.3.24175.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@dotnet-actwx-bot @dotnet/compat

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Mar 28, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@Junjun-zhao
Copy link
Member Author

@marcpopMSFT Could you please help check this issue and confirm if it is a blocker for .NET 9 Preview3? Please help move to the correct team if it is incorrect. Thanks.

@marcpopMSFT
Copy link
Member

This should be moved to the Roslyn repo most likely but I don't have permissions to move it. @jaredpar

@jaredpar
Copy link
Member

jaredpar commented Apr 2, 2024

Closing as a duplicate of dotnet/roslyn#72750

@jaredpar jaredpar closed this as completed Apr 2, 2024
@Junjun-zhao
Copy link
Member Author

Verified it with dotnet-sdk-9.0.100-preview.4.24223.3, this issue has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants