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

'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Roslynator.Core, Version=4.1.2.0 #1001

Closed
MalcolmEllis opened this issue Nov 27, 2022 · 2 comments · Fixed by #1002

Comments

@MalcolmEllis
Copy link

Product and Version Used: Roslynator 2022 v.4.1.2 - VS2022 17.4.1, Windows 10 Pro 21H2

Steps to Reproduce: Seems to be tied to whether the VS setting (text editor/c#/advanced) 'run code analysis in separate process' is on, and that the last update of VS 2022 turned that 'on' by default. Switching that off stops the error. Also, seems to have the same underlying cause as this: https://community.sonarsource.com/t/ad0001-errors-system-io-filenotfoundexception-could-not-load-file-or-assembly-sonaranalyzer-cfg/71341/15 Someone in that thread mentioned the 'separate process' switch as a workaround. Sonar have now fixed their extension so I tried toggling the separate process back on and got this error message from Roslynator. Quite possible that this warning was happening before but the Sonar extension caused so many thousands of its warnings that I didn't notice the Roslynator one in the deluge.

Actual Behavior:
Warning AD0001 Analyzer 'Roslynator.CSharp.Analysis.ValueTypeObjectIsNeverEqualToNullAnalyzer' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'. The system cannot find the file specified.'.
System.IO.FileNotFoundException: Could not load file or assembly 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'. The system cannot find the file specified.
File name: 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'
---> System.IO.FileNotFoundException: Could not load file or assembly 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'. The system cannot find the file specified.
File name: 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'
---> System.IO.FileNotFoundException: Could not load file or assembly 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'. The system cannot find the file specified.
File name: 'Roslynator.Core, Version=4.1.2.0, Culture=neutral, PublicKeyToken=926ea54d246a765e'
at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at Microsoft.CodeAnalysis.DefaultAnalyzerAssemblyLoader.DirectoryLoadContext.Load(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Roslynator.CSharp.Analysis.ValueTypeObjectIsNeverEqualToNullAnalyzer.get_SupportedDiagnostics()
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager.AnalyzerExecutionContext.<>c__DisplayClass20_0.b__0(Object _)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action1 analyze, TArg argument, Nullable1 info)

Expected Behavior:
no error message

@josefpihrt
Copy link
Collaborator

Thanks for the report and for referencing the issue at Sonar. It helped me to fix the issue.

@MalcolmEllis
Copy link
Author

MalcolmEllis commented Nov 28, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants