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

What to do with Analyzers after upgrade? #386

Open
sitty opened this issue Mar 26, 2021 · 13 comments
Open

What to do with Analyzers after upgrade? #386

sitty opened this issue Mar 26, 2021 · 13 comments
Labels
community reported Triaged Label to show that UA team has triaged this issue.

Comments

@sitty
Copy link

sitty commented Mar 26, 2021

What should be done with Microsoft.Dotnet.UpgradeAssistant.Extenstions.Default.Analyzers package after upgrade? Is it supposed to be removed?
I completed upgrade of a class library and now I several warnings from different Analyzers like these
Warning CS8032 An instance of analyzer Microsoft.DotNet.UpgradeAssistant.Extensions.Default.CSharp.Analyzers.AllowHtmlAttributeAnalyzer cannot be created from C:\Users\xxxx.nuget\packages\microsoft.dotnet.upgradeassistant.extensions.default.analyzers\0.2.217201\analyzers\dotnet\cs\Microsoft.DotNet.UpgradeAssistant.Extensions.Default.CSharp.Analyzers.dll: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

@twsouthwick
Copy link
Member

Where are you seeing this warning? Is it in VS or .NET CLI? If so, can you share which version of the tool you're using?

@sitty
Copy link
Author

sitty commented Mar 30, 2021

I get the warnings in VS and in command line when running dotnet build. I'm using version 0.2.217201+d343ba735920891597ff387f9445430b478cf267
When I build the project in Release configuration some of these warnings show up are errors.

@paulomorgado
Copy link

@sitty, does the .csproj files have any PackageReference with microsoft.dotnet.upgradeassistant.*?

@sitty
Copy link
Author

sitty commented Mar 30, 2021

Yes it does
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.2.217201">

@twsouthwick
Copy link
Member

@sitty which version of VS? Sounds like we may be using too late of a version of the code analysis library when run in VS.

Upgrade Assistant will add the analyzers to your project. If you are done with them, feel free to remove them. We could look at removing them as well. However, if we were to downgrade which of code analysis library we use, they should run with no problem in VS/CLI and you won't know the difference.

@sitty
Copy link
Author

sitty commented Mar 30, 2021

I'm using Visual Studio 16.8.5

@twsouthwick
Copy link
Member

Cool. So some action items for us to explore:

  • Downgrade Microsoft.CodeAnalysis libraries so they can run in VS (need to identify which VS version)
  • Remove added analyzers when done

Either would solve the issue you raised, but probably should do both.

@sitty
Copy link
Author

sitty commented Mar 30, 2021

I can try to upgrade VS to16.9.2 and retry. I'm also getting the same warnings upon running dotnet build from terminal.

@twsouthwick
Copy link
Member

We're using the latest code analysis libraries at the moment, which may be ahead of where the CLI/VS is even at. I'm interested to hear the results, though, to verify

@sitty
Copy link
Author

sitty commented Apr 6, 2021

I tested with VS 16.9.3 and I don't get these warnings.

@twsouthwick
Copy link
Member

Ok - so we should look at downgrading some of our analyzer dependencies so that doesn't show up for people

@sunandabalu sunandabalu added the Triaged Label to show that UA team has triaged this issue. label Apr 13, 2021
@sunandabalu
Copy link
Member

@twsouthwick Going to follow-up with Roslyn team on what version to downgrade to.

@IEvangelist
Copy link
Member

I was going to report this as an issue, I too found it odd that a <PackageReference> that was added for part of the upgrade was left behind after the upgrade was successful. I believe it should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community reported Triaged Label to show that UA team has triaged this issue.
Projects
None yet
Development

No branches or pull requests

5 participants