InliningAnalyzer
InliningAnalyzer copied to clipboard
FileNotFoundException on a .NET Standard project and Analyzer dependency
Hi, I'm trying to run the analyzer against my .NET standard project which is an analyzer. (source code: https://github.com/RalfKoban/MiKo-Analyzers )
Unfortunately, I get a lot of FileNotFoundExceptions reported as the analyzer cannot find the Microsoft.CodeAnalysis DLL.
Log:
Microsoft (R)-Build-Engine, Version 16.1.76+g14b0a930a7 fr .NET Core
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
MiKo.Analyzer -> C:\Users\RKoban\AppData\Local\Temp\InliningAnalyzer_1\
Starting Inlining Analyzer...
TargetFramework: netstandard2.0
Assembly: C:\Users\RKoban\AppData\Local\Temp\InliningAnalyzer_1\MiKoSolutions.Analyzers.dll
Runtime: NetCore
Platform: X64
Scope: All Types and Methods
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
File name: 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.CodeAnalysis'
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
File name: 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileNotFoundException: Could not load the specified file.
...
I'm not sure if this is somehow related to the fix for #11, however it would be nice if the inlining analyzer would work.
Best regards, Ralf
I have never tried it with a code analyzer, but you are right, the issue looks similar to #11. I can't debug it right now, but could you try to run this with .Net Framework in the meantime? (Tools -> Inlining Analyzer -> Options -> Select ".Net Framwork" as preferred runtime).
I've switched to ".NET Framework" but get the same exception, just except the stacktrace.
VS Output log:
Publishing project to C:\Users\RKoban\AppData\Local\Temp\InliningAnalyzer_1
Microsoft (R)-Build-Engine, Version 16.1.76+g14b0a930a7 fr .NET Core
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
MiKo.Analyzer -> C:\Users\RKoban\AppData\Local\Temp\InliningAnalyzer_1\
Starting Inlining Analyzer...
TargetFramework: netstandard2.0
Assembly: C:\Users\RKoban\AppData\Local\Temp\InliningAnalyzer_1\MiKoSolutions.Analyzers.dll
Runtime: NetFramework
Platform: X64
Scope: All Types and Methods
System.IO.FileNotFoundException: Die Datei oder Assembly "Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" oder eine Abh„ngigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Dateiname: "Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Text is in German but the english version would be something like:
Could not load file or assembly "Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". File not found.