Giter Site home page Giter Site logo

Comments (12)

glen-nicol avatar glen-nicol commented on July 20, 2024 1

I ended up just reviewing all the errors in VS and using its UI to configure them to suggestions. Thankfully those worked reliably this time! Thanks @sharwell for your help and thanks for all your hard work on dotnet!

from roslyn.

arkalyanms avatar arkalyanms commented on July 20, 2024

Parking on Sam until we tweak the assembly load to match.

from roslyn.

sharwell avatar sharwell commented on July 20, 2024

Can you use Visual Studio's Report a Problem tool to file a report on this with additional information? The specific information we need is a copy of the msbuild.binlog file produced when you build your project from the command line with the -bl flag.

from roslyn.

glen-nicol avatar glen-nicol commented on July 20, 2024

Can you use Visual Studio's Report a Problem tool to file a report on this with additional information? The specific information we need is a copy of the msbuild.binlog file produced when you build your project from the command line with the -bl flag.

I can probably provide that if it will give me the chance to redact portions of it. Are there specific pieces of that file you're looking for? I imagine there will be plenty of type names included that I need to redact.

from roslyn.

sharwell avatar sharwell commented on July 20, 2024

I'd be looking at the inputs to the $task Csc to determine the complete set of AnalyzerConfigFiles passed to the compiler, along with any command line arguments related to the diagnostic you're seeing here. One of them is setting the severity to warning or error. It shouldn't be difficult to locate the source of the severity setting using the MSBuild Log Viewer.

from roslyn.

glen-nicol avatar glen-nicol commented on July 20, 2024

So using MSBuild Log Viewer I was able to find a project that had one error. Figured that would be a simple case to work through. It also happens to be the first error in the build for what that's worth.

...\HttpLib\BasicHttpProvider.cs(9,66): error IDE0090: 'new' expression can be simplified

And in the command line args for compiling that dll I found only these three analyzerconfig arguments:

/analyzerconfig:C:\git\sln\.editorconfig
/analyzerconfig:obj\Debug\netstandard2.0\HttpLib.GeneratedMSBuildEditorConfig.editorconfig
/analyzerconfig:C:\Users\nicolg\.nuget\packages\microsoft.codeanalysis.netanalyzers\8.0.0\buildTransitive\config\analysislevel_8_recommended.globalconfig

None which mention IDE0090.

Have I misunderstood how to interpret the log? Are there other places where severity can be set? I admit I don't know all the arguments for csc, but I didn't see anything obvious. Certainly no IDE0090 explicitely.

from roslyn.

sharwell avatar sharwell commented on July 20, 2024

Do any of those files list csharp_style_implicit_object_creation_when_type_is_apparent?

from roslyn.

glen-nicol avatar glen-nicol commented on July 20, 2024

yes, my main .editorconfig has this:

csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion

hmm, did the legacy true:suggestion severity formatting finally get pulled and now causing a fuss?

from roslyn.

glen-nicol avatar glen-nicol commented on July 20, 2024

I guess the old formatting isn't a problem but not having the new format is. Adding the IDE0090 rule correctly sets the severity and gets rid of the error. Is there a tool that can go through all those and duplicate them? I have quite a few set using the old format.

from roslyn.

sharwell avatar sharwell commented on July 20, 2024

hmm, did the legacy true:suggestion severity formatting finally get pulled and now causing a fuss?

The true:suggestion syntax will start to take effect for .NET 9 SDK with AnalysisLevel set to 9 or greater. It may also work that way in 8.0.300 if you manually set AnalysisLevel to 9 or greater.

csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion

This would not be sufficient to trigger an error. The default severity for IDE0090 is suggestion, and TreatWarningsAsErrors only applies to warnings and errors. If an error is reported in the build, something has reconfigured IDE0090 from its default severity of suggestion to either error, or to warning with TreatWarningsAsErrors enabled.

from roslyn.

glen-nicol avatar glen-nicol commented on July 20, 2024

I have this setup:

<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>All</AnalysisMode>
<AnalysisLevel>latest-recommended</AnalysisLevel>

And I even commented all those out and I still got errors instead of suggestions (This was before I set the rules).

Would 8.0.300 target 9 with latest-recommended? I wouldn't have expected that myself.

from roslyn.

sharwell avatar sharwell commented on July 20, 2024

And I even commented all those out and I still got errors instead of suggestions (This was before I set the rules).

I'm not sure I'll be able to resolve this without a concrete repro (either a sample solution or build log submitted through the feedback system and not posted publicly).

Would 8.0.300 target 9 with latest-recommended?

No, 8.0.300 defines _LatestAnalysisLevel as 8.0.

from roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.