You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug illustrated another problem with our workspaces API: if you're using MSBuildWorkspace, it's really hard to get "all the diagnostics" which might mean your analysis is broken. I can think of at least four kinds of diagnostics we have, and the different ways to get them:
Compiler diagnostics. These are easy -- call GetCompilationAsync().GetDiagnostics().
Analyzer loading diagnostics. These are hard. You can manually subscribe to all the AnalyzerFileReferences to hook an event that will be raised it loaded. But you better do that right away before you miss the event. You also need to deal with analyzer file references that couldn't be resolved at all.
Source generator execution diagnostics. We have these...in an internal API. I think we have no option here short of reflection to get them!
Analyzer diagnostics. You could create your own CompilationWithAnalyzers and run the analyzers here, but it's odd we don't have a shortcut.
MSBuildWorkspace diagnostics. These you get via subscribing to WorkspaceFailed.
We probably need to do some combination of:
Making analyzer loading diagnostics also get raised to WorkspaceFailed, or
Add a simple API like Project.GetDiagnosticsAsync() that just returns all the various things here concatenated together.
The goal not being that the API has to be high performance....it should just be possible.
The text was updated successfully, but these errors were encountered:
This bug illustrated another problem with our workspaces API: if you're using MSBuildWorkspace, it's really hard to get "all the diagnostics" which might mean your analysis is broken. I can think of at least four kinds of diagnostics we have, and the different ways to get them:
We probably need to do some combination of:
The goal not being that the API has to be high performance....it should just be possible.
The text was updated successfully, but these errors were encountered: