question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error at start up of omnisharp: mtoken: 0x0a000006 due to: Cannot resolve dependency to assembly because it has not been preloaded

See original GitHub issue

System: ubuntu 20.04

  1. Open Visual Studio Code v1.52.1
  2. Open my (very big) C# project

Omnisharp mentions me the following errors

Actually, one project of my solution uses these assemblies (microsoft.codeanalysis.*****). But, something interesting: if I put appart the project that references assemblies that seem to be the source of the problem and open it alone in VSCode, I don’t get the problem.

Information: my solution is VERY big.

Starting OmniSharp server at 1/5/2021, 11:31:21 AM
    Target: /home/stephane/Documents/Sources/PMS/src/FundProcess.Pms.sln

OmniSharp server started.
    Path: /home/stephane/.vscode/extensions/ms-dotnettools.csharp-1.23.8/.omnisharp/1.37.5/run
    PID: 9520

Can't find custom attr constructor image: /home/stephane/.nuget/packages/microsoft.codeanalysis.csharp.features/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Features.dll mtoken: 0x0a000006 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: /home/stephane/.nuget/packages/microsoft.codeanalysis.csharp.workspaces/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll mtoken: 0x0a000006 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: /home/stephane/.nuget/packages/microsoft.codeanalysis.features/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.Features.dll mtoken: 0x0a000006 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: /home/stephane/.nuget/packages/microsoft.codeanalysis.csharp.features/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Features.dll mtoken: 0x0a000006 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: /home/stephane/.nuget/packages/microsoft.codeanalysis.csharp.workspaces/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll mtoken: 0x0a000006 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: /home/stephane/.nuget/packages/microsoft.codeanalysis.features/3.8.0/lib/netcoreapp3.1/Microsoft.CodeAnalysis.Features.dll mtoken: 0x0a000006 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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:7

github_iconTop GitHub Comments

3reactions
AaronJaccommented, Oct 23, 2021

Setting omnisharp.enableMsBuildLoadProjectsOnDemand to true solved the problem for me.

1reaction
TheBoneJarmercommented, Feb 3, 2021

I’m having the same issue. Omnisharp stops functioning more often. I noticed I am spending lots of time trying to get intellisense up and running again. Restarting omnisharp sometimes helps but not always.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot resolve dependency to assembly because it has not ...
dll mtoken: 0x0a000005 due to: Cannot resolve dependency to assembly because it has not been preloaded. When using the ReflectionOnly APIs, ...
Read more >
Reason for "Cannot resolve dependency to assembly" error
This can happen if your xaml file statically references a view model class and that view model class has a dependency which may...
Read more >
Can't get VS Code C# extension to work in my Archlinux system
Hi, I want to start with Unity development on my Archlinux machine, ... Editor.dll mtoken: 0x0a000007 due to: Could not find method '.ctor' ......
Read more >
How can i solve this error? - MSDN - Microsoft
When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve ...
Read more >
'Cannot resolve dependency to assembly 'PostSharp, Version ...
37.9, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found