Get the level and category of each warning, for forwarding to external system #50535
-
I'd like to collect warnings reported by the Roslyn C# compiler or analyzers, and forward them to a system that supports additional metadata for each warning:
The C# compiler knows about levels and categories. For example, CS1573 is documented as a level 4 warning, and CA3147 is documented as being in the "Microsoft.Security" category. I could perhaps map levels to severities, and categories to types. Can I tell the compiler to include the level and category in each warning that it writes to stderr? Alternatively, is there a file that lists the level and category of each known warning, so that I could use it to enrich the warnings after the compiler has output them? Maybe I should have asked this in https://github.com/dotnet/roslyn/discussions/ instead. I see a "Transfer discussion" link but it does not list that as an available repository. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You need to have write access to the repos to transfer an issue. As to your question, I believe what you are looking for is the |
Beta Was this translation helpful? Give feedback.
You need to have write access to the repos to transfer an issue.
As to your question, I believe what you are looking for is the
errorlog
csc option, which can be accessed in MSBuild with theErrorLog
property. That will allow you specify an output sarif file that will log diagnostics from the compiler.