Cannot find project references after update to Big Sur
See original GitHub issueIssue Description
I want to mention that I haven’t had an issue with this Solution until after I upgraded the OS.
OK, so I have a solution which contains 7 projects. Of the 7 projects 5 are targeting net5.0.
One project targets netstandard2.0, and another targets .Net 4.8 (legacy).
The issue After upgrading my Mac to Big Sur I started receiving the following OmniSharp error in VSCode:
Can’t find custom attr constructor image: /Some/Path/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
Now, I can build and run the projects with no issue but every project that references/uses the WebCommon project has a ton of red squiggles.
The WebCommon project is a common project (obviously) shared amongst a few of the other projects in the solution.
The WebCommon project targets net5.0 and is only included by a few of the other projects that also target net5.0 (The WebCommon project is not included by either the netstandard or .Net 4.8 legacy projects.
The WebCommon project has the following references:
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
<PackageReference Include="Grpc.Core" Version="2.33.1" />
<PackageReference Include="Grpc.Tools" Version="2.33.1">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
I have also ensured that omnisharp.useGlobalMono
is set to never
. (This was a warning emitted by OmniSharp).
Steps to Reproduce
Upgrade Mac to Big Sur and then open a C#
project.
Expected Behavior
OmniSharp to detect project references.
Actual Behavior
OmniSharp cannot detect project references.
Logs
OmniSharp log
Starting OmniSharp server at 11/14/2020, 3:34:51 PM Target: /Users/wbuckley/Projects/DelphaxWeb/DelphaxWeb.sln
OmniSharp server started. Path: /Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/run PID: 3889
Starting OmniSharp on MacOS 11.0.1 (x64)
DotNetPath set to dotnet
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
MSBUILD_EXE_PATH environment variable set to '/Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
Registered MSBuild instance: StandAlone 16.8.0 - "/Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /Users/wbuckley/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild
Detecting Cake files in '/Users/wbuckley/Projects/DelphaxWeb'.
Could not find any Cake files
Detecting projects in '/Users/wbuckley/Projects/DelphaxWeb/DelphaxWeb.sln'.
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebUI/WebUI.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebTest/WebTest.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebAPI/WebAPI.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebAgent/WebAgent.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/WebPDF/WebPDF.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/Inspector/Inspector.csproj'
Queue project update for '/Users/wbuckley/Projects/DelphaxWeb/InspectorCommon/InspectorCommon.csproj'
Detecting CSX files in '/Users/wbuckley/Projects/DelphaxWeb'.
Could not find any CSX files
Loading project: /Users/wbuckley/Projects/DelphaxWeb/WebUI/WebUI.csproj
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
Configuration finished.
Omnisharp server running using Stdio at location '/Users/wbuckley/Projects/DelphaxWeb' on host 3824.
Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/bin/Debug/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘/Users/wbuckley/Projects/DelphaxWeb/WebUI/WebUI.csproj’. info: OmniSharp.MSBuild.ProjectManager Adding project ‘/Users/wbuckley/Projects/DelphaxWeb/WebUI/WebUI.csproj’ info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj [fail]: OmniSharp.MSBuild.ProjectLoader “/Users/wbuckley/.nuget/packages/grpc.tools/2.33.1/tools/linux_x64/protoc” exited with code 255. [warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file ‘/Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj’. /Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj /Users/wbuckley/.nuget/packages/grpc.tools/2.33.1/build/_protobuf/Google.Protobuf.Tools.targets(280,5): Error: “/Users/wbuckley/.nuget/packages/grpc.tools/2.33.1/tools/linux_x64/protoc” exited with code 255.
Loading project: /Users/wbuckley/Projects/DelphaxWeb/WebTest/WebTest.csproj
Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/bin/Debug/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebAPI/bin/Debug/net5.0/WebAPI.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘/Users/wbuckley/Projects/DelphaxWeb/WebTest/WebTest.csproj’. info: OmniSharp.MSBuild.ProjectManager Adding project ‘/Users/wbuckley/Projects/DelphaxWeb/WebTest/WebTest.csproj’ info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/wbuckley/Projects/DelphaxWeb/WebAPI/WebAPI.csproj Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/bin/Debug/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘/Users/wbuckley/Projects/DelphaxWeb/WebAPI/WebAPI.csproj’. info: OmniSharp.MSBuild.ProjectManager Adding project ‘/Users/wbuckley/Projects/DelphaxWeb/WebAPI/WebAPI.csproj’ info: OmniSharp.MSBuild.ProjectManager Loading project: /Users/wbuckley/Projects/DelphaxWeb/WebAgent/WebAgent.csproj Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/bin/Debug/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. [warn]: OmniSharp.MSBuild.ProjectManager Expected project reference /Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj to be already loaded for project WebAPI [warn]: OmniSharp.MSBuild.ProjectManager Expected project reference /Users/wbuckley/Projects/DelphaxWeb/WebCommon/WebCommon.csproj to be already loaded for project WebAPI info: OmniSharp.OmniSharpWorkspace Miscellaneous file: /Users/wbuckley/Projects/DelphaxWeb/WebAPI/obj/Debug/net5.0/WebAPI.MvcApplicationPartsAssemblyInfo.cs added to workspace Can’t find custom attr constructor image: /Users/wbuckley/Projects/DelphaxWeb/WebCommon/bin/Debug/net5.0/WebCommon.dll mtoken: 0x0a000001 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. info: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: using Moq; info: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: using WebAPI.Services; info: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: using System.Threading; info: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: using Microsoft.Extensions.Logging;
Environment information
VSCode version: 1.52.0-insider C# Extension: 1.23.6
Mono Information
OmniSharp using built-in monoDotnet Information
.NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829Runtime Environment: OS Name: Mac OS X OS Version: 11.0 OS Platform: Darwin RID: osx.11.0-x64 Base Path: /usr/local/share/dotnet/sdk/5.0.100/
Host (useful for support): Version: 5.0.0 Commit: cf258a14b7
.NET SDKs installed: 3.1.101 [/usr/local/share/dotnet/sdk] 3.1.102 [/usr/local/share/dotnet/sdk] 3.1.200 [/usr/local/share/dotnet/sdk] 3.1.300 [/usr/local/share/dotnet/sdk] 3.1.301 [/usr/local/share/dotnet/sdk] 3.1.302 [/usr/local/share/dotnet/sdk] 3.1.401 [/usr/local/share/dotnet/sdk] 3.1.402 [/usr/local/share/dotnet/sdk] 3.1.403 [/usr/local/share/dotnet/sdk] 5.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.19 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
cmake | twxs | 0.0.17 |
cmake-tools | ms-vscode | 1.5.2 |
cpptools | ms-vscode | 1.1.1 |
crates | serayuzgur | 0.5.3 |
csharp | ms-dotnettools | 1.23.6 |
docomment | k–kato | 0.1.19 |
even-better-toml | tamasfe | 0.9.3 |
halcyon-vscode | brittanychiang | 0.2.17 |
html5-boilerplate | sidthesloth | 1.1.1 |
jupyter | ms-toolsai | 2020.11.358541065 |
mssql | ms-mssql | 1.9.0 |
numbered-bookmarks | alefragnani | 7.2.0 |
python | ms-python | 2020.11.358366026 |
remote-containers | ms-vscode-remote | 0.149.0 |
rust | rust-lang | 0.7.8 |
rust-analyzer | matklad | 0.2.376 |
theme-cobalt2 | wesbos | 2.1.6 |
vscode-docker | ms-azuretools | 1.7.0 |
vscode-icons | vscode-icons-team | 11.0.0 |
vscode-lldb | vadimcn | 1.6.0 |
vscode-proto3 | zxh404 | 0.5.2 |
vscode-theme-onedark | akamud | 2.2.2 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
@JoeRobich sorry it’s my bad. Since I am using vs code for almost 3 years, I even forgot about Visual Studio 😃
I am updating VS now. It’s gonna work probably. Thanks.
@suadev If you have Visual Studio (or MSBuild Tools) installed be sure that you are on version 16.8 or higher. NET 5 requires a 16.8 MSBuild (see https://github.com/OmniSharp/omnisharp-vscode#note-about-using-net-5-sdks).