Severity Code Description Project File Line Suppression State Detail Description
Warning AD1000 An instance of analyzer Microsoft.NetCore.Analyzers.Runtime.TestForNaNCorrectlyAnalyzer cannot be created from C:\USERS\USER\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\15.0_3E26AB4A\EXTENSIONS\1FHMJXO3.2K0\Microsoft.NetCore.Analyzers.dll: Exception has been thrown by the target of an invocation.. 1 Active System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.Semantics.BinaryOperationKind' from assembly 'Microsoft.CodeAnalysis, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Microsoft.NetCore.Analyzers.Runtime.TestForNaNCorrectlyAnalyzer..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
1.GetAnalyzersForTypeNames(Assembly analyzerAssembly, IEnumerable1 analyzerTypeNames, Boolean& reportedError)System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.Semantics.BinaryOperationKind' from assembly 'Microsoft.CodeAnalysis, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Microsoft.NetCore.Analyzers.Runtime.TestForNaNCorrectlyAnalyzer..ctor()
you are running an older analyzer package of FxCop, which is not compatible with your VS version. Can you please try the version as per https://github.com/dotnet/roslyn-analyzers#recommended-version-of-analyzer-packages?
Visual Studio 15.5.1.
I ran FxCop 2.3.0 and got CA1012 (message) and then this AD1000 (warning). I resolved the first one and didn't get any others. Then I upgraded to FxCop 2.6.0 via NuGet and disabled the extension, and got CA1052 (warning) and then AD1000 (warning) again, and then CA1052 (message) for the same issue as before. I thought it was weird to see the same message with different levels.
@Jesdisciple Can you please share a repro project or paste the diagnostics that you get for your project?
When I started VS this morning, I found the AD1000 had left, presumably fixed by the restart. Here's the project anyway.
And I had restarted after switching versions of FxCop. I guess it just needed two restarts.
I am having a bit of a catch 22 here.
I cannot move 100+ developers from 15.4.5 to 15.5.x at the same time, but it seems that the 2.3 analysers cannot work with 15.5.x and when trying to get the 2.6 analysers to work it seems that it will force me to convert our portable project to .Net Standard because Microsoft.CodeAnalysis.dll is not delivered in a portable version.
After installing VS 15.5 (up from 15.4.5) I am getting a lot of errors from the analysis:
error CS8032: An instance of analyzer Microsoft.NetCore.Analyzers.Runtime.TestForNaNCorrectlyAnalyzer cannot be created from path\Microsoft.NetCore.Analyzers.2.3.0-beta1\analyzers\dotnet\cs\Microsoft.NetCore.Analyzers.dll : Exception has been thrown by the target of an invocation..
Upgrading to newest package of that package (2.6.0-beta1) leads to problems with the other analyzers:
error CA9999: Version mismatch between the analyzer package 'Microsoft.NetFramework.Analyzers-2.3.*' and Microsoft.CodeAnalysis '2.6.0.0'. Certain analyzers in this package will not run until the version mismatch is fixed. Analyzers in this package are preview version and are tied to a specific API version of Microsoft.CodeAnalysis. Please switch your analyzer NuGet package/VSIX to a matching version of the Microsoft.CodeAnalysis.
Upgrading all analyzers makes it work in 15.5 but then it does not work in 15.4.x:
Error CS8032: An instance of analyzer Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.MarkAttributesWithAttributeUsageAnalyzer cannot be created from D:\Builds\Agent-53-01_work\19\s\packages\Microsoft.CodeQuality.Analyzers.2.6.0-beta1\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
Microsoft.CodeAnalysis.dll can be obtained in a seperate package but it does not support portable which we still have a few projects that are based on:
Could not install package 'Microsoft.CodeAnalysis.Common 2.6.0-beta3'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I need a solution so that our team can make a slow transition between Visual Studio versions
@toredk One of the ways to workaround this problem would be:
Also note that Microsoft.CodeAnalysis NuGet package is primarily for projects that intend to consume the public APIs from Microsoft.CodeAnalysis dlls, for example, if you are writing analyzers, code fixers, etc. Installing this package does not change the compiler version or the version against which the analyzers execute. You should upgrade to higher version of this package only if you need to use newer CodeAnalysis APIs in your project.
I know this is darn confusing, so feel free to ping again if you have further questions. Hope it helps.
I installed the update 15.5.1 today and this warning appeared. I do not have FxCop in my project.
@ArchieCoder Which warning are you talking about? Can you paste the diagnostic?
I do not have FxCop in my project
Do you have any NuGet/VSIX installed analyzers for your project?
@mavasani

@ArchieCoder Thanks, can you please also paste your diagnostic info and solution explorer screenshot for the Analyzers node (should be under Dependencies or References node for the project)?
@mavasani I sent you an email.
I followed up offline with @ArchieCoder and the issue was resolved.
I too have the issue where I have Visual Studio 2017 15.5.1 and I have the Marketplace Microsoft Code Analysis 2017 (Version | 2.3.0.62003) VSIX installed.
I too get the AD1000 warning.
Am I supposed to remove the extension and just use the nuget packages? Is there a way to get the extension based on 2.6.0 beta 2?
@dotnetshadow Yes, you should get the analyzers via the nuget package https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/2.6.0-beta2 for VS2017 15.5 or later.
We are currently working on publishing the VSIX for 15.5, but that is currently blocked by https://github.com/dotnet/roslyn/issues/23766
@mavasani cheers, perhaps the Marketplace can be edited to put a note for people using 15.5 or later so that they know they can't use the extension and should use the nuget packages instead?
perhaps the Marketplace can be edited to put a note for people using 15.5 or later so that they know they can't use the extension and should use the nuget packages instead?
Tagging @kuhlenh
@mavasani Just one thing with the nuget packages, if I have like 5 projects in one solution do I have to apply the nuget package to all projects?
@dotnetshadow Yes, NuGet package is a per-project entity. You can also add a PackageReference to a common targets file that is imported by all projects in your solution.
+1 started to get this after upgrading to dotnet SDK v2.1.3
To repro, install the latest dotnet SDK then run build -clean in the root of this repo: https://github.com/azure/azure-iot-sdk-csharp
@CIPop, looking at that repo it appears you're using the 2.3.0-beta1 version of the analyzers. This is expected behavior after upgrading your SDK, please upgrade your analyzer version to 2.6.0-beta2.
please upgrade your analyzer version to 2.6.0-beta2
Is this backward compatible with the old SDK? (We have Jenkins Docker containers, Windows VMs and devs that may still use the old SDK...)
Unfortunately, it is not. The IOperation API that these analyzers use was finalized with the 15.5 release of VS/2.1.3 release of .NET SDK. This is why previously, you had to enable the IOperation API with <Features>IOperation</Features> in your project file, and why the 2.3.0-beta versions of the analyzers no longer work.
@mavasani Hey you said it was blocked by dotnet/roslyn#23766 but that is already closed. So can this be published for 15.5+? Thx
That bug was fixed for future releases of VS, namely 15.6. @mavasani can confirm, but I don't believe we are backporting the fix to 15.5.
The extension for 15.5+ has been published: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2017
Note that next Visual Studio preview release should have resolved dotnet/roslyn#23766, at which point you should be able to have both the VSIX and NuGet package installed simultaneosly.
Is the extension still in preview as stated in https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2017 ?
I installed it and thenI added the 2.6.0 NuGet packages for testing on Visual Studio 15.5.3. When I build I get the error referenced at https://github.com/dotnet/roslyn/issues/23766
@alfredmyers unfortunately the fix for 23766 is not in 15.5 , it's available only from 15.6.preview3
Most helpful comment
That bug was fixed for future releases of VS, namely 15.6. @mavasani can confirm, but I don't believe we are backporting the fix to 15.5.