-
Notifications
You must be signed in to change notification settings - Fork 689
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
System.Reflection.ReflectionTypeLoadException when getting code actions #5105
Comments
I have this too! If you try ctrl+. a few times does it eventually work? May be related to #5085 and #5091 There are a MANY problems with the newest version. vscode devs, please release a hotfix for #5089 so we don't have to wait a whole month for the next release. Rolling back is also no good as there were bugs there too, so were excited to upgrade to this release, but now there are new bugs! |
According to the exception in your logs, the analyzer your project is trying to load is relying on some type that is unavailable. This is a relatively common problem on the minimal Mono that OmniSharp by default ships with. Probably the best solution would be to switch to the .NET 6 build of OmniSharp by setting |
@filipw I have the same problem, but my log is:
I am using the dotnet6 build, NOT unity, with |
This is not the same problem , only looks similar. In your case the missing type is 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. This means your analyzers require Roslyn 4.1.0 but your OmniSharp does not have it, which tells me you are on old version of the extension. OmniSharp was upgraded to Roslyn 4.1.0 OmniSharp/omnisharp-roslyn#2329 here, which shipped in extension 1.24.1. You need to upgrade to that. |
@filipw Thanks for providing this. Unfortunately we can't really upgrade .NET 6 SDK just yet. Not really a big issue, I can just do code refactoring through VS for the time being. Would be great if upgrades were more backwards compatible with older .NET versions, since this was working for me not to long ago. Any chance this could get fixed in an upcoming release or is upgrading the only option? |
The types needed at runtime are not dictated by OmniSharp but by our dependencies (primarily Roslyn) and any analyzer packages your project would use. The minimal Mono bundled by OmniSharp does not have the full .NET type surface available for size reasons and such missing type errors happen(ed) from time to time. You did not post the full log so I do not known which OmniSharp mode you are running, but judging by the exception I am guessing it is this minimal Mono. Now that said, this minimal Mono mode (that was used by default so far) is currently deprecated, is no longer maintained and has already been removed in the latest beta version. Going forward you have two options:
In either case, the full .NET type surface will be available. |
I just came across this, but the latest suggestion is not working for me. I installed Mono for Windows x64. |
I am also seeing this on a small .NET 7 project. Simple code fixes are not available (naming violations, etc.) Seeing the same System.Reflection.ReflectionTypeLoadExceptoin over and over.
|
Experiencing this issue as well |
Months passed already. Just as Jonkelling said, it works normally on MacOS, but not on Windows. I don't know why... |
I'm currently experiencing this error after upgrading to .net 8 |
Same here! How to fix this? Its pretty annoying. |
I get this in Unity, trying to load a DLL that I built myself and put right there in unity, with Full Paths set in the .csproj file. The amount of time I've recently spent trying to make intellisense just work with CSharp is more than I've actually coded anything. I'm really considering changing my IDE or something. |
A while back there were a few changes, and since then everything has been working better.
|
Make sure, if you're using assembly definitions, that your .asmdef file has the DLL listed in |
Problem solved after installing |
Environment data
dotnet --info
output:VS Code version:
C# Extension version:
OmniSharp log
Steps to reproduce
Example Issue is here: https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/Data/Template/ExpressionHelpers.cs#L218
Where the refactor suggestion is
'if' statement can be simplified [PSRule.Rules.Azure]
.If you try
Ctrl + .
, it saysNo code actions available.
Expected behavior
This stopped working recently. Ussually I can refactor with
Ctrl + .
just fine.Actual behavior
No code actions available
message popup.The text was updated successfully, but these errors were encountered: