Roslyn-analyzers: Warning AD1000 An instance of analyzer Microsoft.CodeQuality.VisualBasic.Analyzers.QualityGuidelines.BasicRemoveEmptyFinalizersAnalyzer cannot be created from

Created on 7 May 2020  路  8Comments  路  Source: dotnet/roslyn-analyzers

Analyzer package

Microsoft.CodeAnalysis.FxCopAnalyzers

Package Version

v3.0.0 (Latest)

Diagnostic ID

AD1000

When I upgraded v3.0.0 on a VB project, I now get 3 warnings:

  1. Warning AD1000 An instance of analyzer Microsoft.CodeQuality.VisualBasic.Analyzers.QualityGuidelines.BasicRemoveEmptyFinalizersAnalyzer cannot be created from C:USERS[myusername]APPDATALOCALMICROSOFTVISUALSTUDIO16.0_1C5A59DEEXTENSIONSS33QTOEX.YSRMicrosoft.CodeQuality.VisualBasic.Analyzers.dll: Could not load type 'Microsoft.CodeQuality.VisualBasic.Analyzers.QualityGuidelines.BasicRemoveEmptyFinalizersAnalyzer' from assembly 'Microsoft.CodeQuality.VisualBasic.Analyzers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'..

  2. Warning AD1000 An instance of analyzer Microsoft.NetCore.VisualBasic.Analyzers.Runtime.BasicDoNotRaiseReservedExceptionTypesAnalyzer cannot be created from C:USERS[myusername]APPDATALOCALMICROSOFTVISUALSTUDIO16.0_1C5A59DEEXTENSIONS03NBL5HJ.C2UMicrosoft.NetCore.VisualBasic.Analyzers.dll: Could not load type 'Microsoft.NetCore.VisualBasic.Analyzers.Runtime.BasicDoNotRaiseReservedExceptionTypesAnalyzer' from assembly 'Microsoft.NetCore.VisualBasic.Analyzers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'..

  3. Warning AD1000 An instance of analyzer Microsoft.NetCore.Analyzers.Security.DoNotDisableSchUseStrongCrypto cannot be created from C:USERS[username]APPDATALOCALMICROSOFTVISUALSTUDIO16.0_1C5A59DEEXTENSIONS03NBL5HJ.C2UMicrosoft.NetCore.Analyzers.dll: Could not load type 'Microsoft.NetCore.Analyzers.Security.DoNotDisableSchUseStrongCrypto' from assembly 'Microsoft.NetCore.Analyzers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'..

Repro steps

  1. Create a VB .Net Framework project.
  2. Install FxCop 3.0
  3. Compile project

Expected behavior

No AD1000 warnings.

Actual behavior

3x AD1000 warnings.

Most helpful comment

@BOBJohnson Seems like you have installed "Microsoft Code Analysis VS2019" Extension. Can you please uninstall the extension and retry?

All 8 comments

@BOBJohnson Seems like you have installed "Microsoft Code Analysis VS2019" Extension. Can you please uninstall the extension and retry?

Ah yes. I initially installed via the Install button via the Project Properties -> Code Analysis 'Install' button. When I do this, it installs 2.9.6 - I then went into the NuGet package manager and told it to update FxCop to 3.0.0

I'll try uninstalling everything, and then installing just via NuGet.

That seemed to work. I went into Project Properties -> Code Analysis and clicked Uninstall button. Then I closed out, and reopened VS 2019. Then I opened the NuGet package manager and used that to install FxCop 3.0.0 directly.

Something must have gone wrong while doing the update. Fresh install worked.

Hmmm....I close out of project / VS 2019. Then just now came back, and as soon as I opened it, I got the warning.

I also just checked my installed extensions via Extensions -> Manage Extensions, and I don't have FxCop installed as a VSIX.

Seems like somehow the VS MEF cache is outdated. Can you try closing VS, running devenv /updateconfiguration from admin command prompt and then restart VS?

Okay sorry I was wrong. When looking through the manage extensions I looked for FxCop and didn't see it.

I just realized you called it something different, and went back in and yep had it. Uninstalling it now. Chalk this up to PEBKAC.

@mavasani

@BOBJohnson Seems like you have installed "Microsoft Code Analysis VS2019" Extension. Can you please uninstall the extension and retry?

Thank you - that fixed it for me (I didn't uninstall it, but I did disable it).

But why does this happen? Why would VS 2019 ship with an extension that causes warning messages when building .NET Core projects? I'm also using the latest version of that extension (3.0.0.19255803) and the "Release Notes" link says just this, with no mention of it causing conflicts with projects using Code Analysis via NuGet:

May 2019: v3.0.0 Official Release
Requires Visual Studio 2019 RTW or later.

Finally, the "More Information" link opens this page ( https://docs.microsoft.com/en-us/visualstudio/code-quality/install-fxcop-analyzers?view=vs-2019#to-install-fxcop-analyzers-as-a-vsix ) - which again, makes no mention of problems and when I read the VSIX section I get the impression that it's a recommended installation because it says "The Microsoft Code Analysis 2019 extension contains all of the FxCop analyzers for managed projects" (emphasis mine) - so my thinking (back when I installed the extension a few months ago) was that installing the extension would mean I wouldn't need to add the Code Analysis NuGet packages to all of my projects.

...and also because I round-trip some projects between VS2017 and VS2019, but VS2017 chokes when using NuGet packages newer than version 2.9.9 but we always need to use the latest NuGet package with VS2019 (I think?).

So if I understand it correctly, I can't have it both ways? (i.e. I can't have code-analysis working reliably for a project that's opened in both VS2017 and VS2019?)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

x3ntrix picture x3ntrix  路  3Comments

paulomorgado picture paulomorgado  路  3Comments

KrisVandermotten picture KrisVandermotten  路  3Comments

onyxmaster picture onyxmaster  路  3Comments

Youssef1313 picture Youssef1313  路  4Comments