Open DmitriyMaksimov opened 2 weeks ago
The default severity is Hidden
(silent), which means that your IDE shouldn't report it in the error window or in the text editor.
This rule is only intended to help developers by providing a refactoring to easily convert a string to an interpolated string.
Nothing visible:
You get a refactoring (similar to the existing one, provided by roslyn, to convert to raw string)
For the documentation, I'll add it (and check why the CI didn't catch it)
Same issue with Visual Studio 17.11.5: [assembly: AssemblyTitle("Any text here")]
Only using dotnet_diagnostic.MA0165.severity=suggestion fixed the compiler error
dotnet_diagnostic.MA0165.severity=suggestion
would make it visible in the IDE, which is not intended. I do not reproduce the issue on my side (using VS 17.12 preview 4).
dotnet_diagnostic.MA0165.severity=silent
fixed the compiler error
Which compiler error? Do you have an error when building the project?
Thank you very much for a such quick reply, @meziantou! 🙏 And thank you for absolutely great project! Your analyzer is what I add to all C# projects - IMO it's "must have" 👍
You are right - I have the following in .editorconfig
file
# default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = error
It's why I'm getting errors. It's a bit surprising that the default has a higher priority than defined in the analyzer.
Adding the following .editorconfig
dotnet_diagnostic.MA0165.severity = none
resolves the issue.
BTW, Rider has the same code fix for a long time ("To string interpolation"), so for Rider users it's redundant (and confusing which one to use 😁). But for VS users, it's a great code fix (for such users, the severity should be set to silent
)! 👍
FYI: Rider is now free for non-commercial use - so you can use it for your project.
Same for us, our default severity is error, came here so we had to do the
dotnet_diagnostic.MA0165.severity = none
Version of the Meziantou.Analyzer NuGet package
2.0.175
Rule Identifier
MA0165
Target Framework
net8.0
C# Language version
C# 10
Description
After upgrading to
2.0.175
from2.0.173
getting the following errorsRequired change doesn't make much sense - the analyzer requires converting all strings to interpolated strings
Also, the link
https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0165.md
is brokenReproduction Steps
Minimal code:
Other information
No response