Catch exceptions from user code - #1139
Merged
Merged
Conversation
The Solution Explorer calls `DiagnosticAnalyzer.SupportedDiagnostics` to determine the list of items to show. This property is implemented by a 3rd-party (the analyzer author) and could potentially throw. Here we move to using the `DiagnosticAnalyzerService` to obtain this data; it will catch any exceptions and handle reporting them to the user as appropriate. Fixes dotnet#898.
Contributor
Author
|
@srivatsn @shyamnamboodiripad @mavasani @jmarolf @heejaechang @JohnHamby Could you take a look at this, please? |
Contributor
|
👍 |
Contributor
There was a problem hiding this comment.
If this cast is safe, why isn't the type of the field DiagnosticAnalyzerService?
Contributor
There was a problem hiding this comment.
We should also consider just adding the GetDiagnosticDescriptors(Analyzer) method to IDiagnosticAnalyzerService interface.
Contributor
There was a problem hiding this comment.
@tmeschter can we just do that as part of this change?
Contributor
|
I sign off, because this is surely a good thing, |
Contributor
|
👍 |
Contributor
|
👍 @tmeschter @mavasani Tom, can you just add the method as part of the interface? |
Contributor
Author
|
@dotnet-bot Retest this, please. |
Contributor
Author
|
@heejaechang @mavasani I'll add the method to the interface. |
Add the `GetDiagnosticDescriptors(DiagnosticAnalyzer)` method to the `IDiagnosticAnalyzerService` interface.
tmeschter
added a commit
that referenced
this pull request
Mar 10, 2015
Catch exceptions from user code
dibarbet
pushed a commit
that referenced
this pull request
Aug 18, 2026
Support span and minimum severity in CreateFixAllContext
This was referenced Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Solution Explorer calls
DiagnosticAnalyzer.SupportedDiagnosticstodetermine the list of items to show. This property is implemented by a
3rd-party (the analyzer author) and could potentially throw.
Here we move to using the
DiagnosticAnalyzerServiceto obtain thisdata; it will catch any exceptions and handle reporting them to the user
as appropriate.
Fixes #898.