Throw NotImplementedException when a build errorId is not supported#82508
Merged
Throw NotImplementedException when a build errorId is not supported#82508
Conversation
src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs
Outdated
Show resolved
Hide resolved
The cache is updated when projects are added/removed from the workspace or when AnalyzerReferences are added/removed from projects. The cache is used to answer whether a project can generate a particular diagnostic id synchronously.
JoeRobich
commented
Feb 28, 2026
src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
Member
Author
|
@jasonmalinowski This is ready for another look. |
akhera99
approved these changes
Mar 2, 2026
src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs
Outdated
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.DiagnosticDescriptorCache.cs
Outdated
Show resolved
Hide resolved
...tures/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService_RemoteOrLocalDispatcher.cs
Outdated
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.DiagnosticDescriptorCache.cs
Outdated
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.DiagnosticDescriptorCache.cs
Outdated
Show resolved
Hide resolved
...res/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.DiagnosticDescriptorCache.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs
Outdated
Show resolved
Hide resolved
JoeRobich
commented
Mar 3, 2026
src/Features/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService.cs
Show resolved
Hide resolved
JoeRobich
commented
Mar 3, 2026
...tures/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService_RemoteOrLocalDispatcher.cs
Outdated
Show resolved
Hide resolved
JoeRobich
commented
Mar 3, 2026
src/Features/Core/Portable/Diagnostics/IDiagnosticAnalyzerService.cs
Outdated
Show resolved
Hide resolved
JoeRobich
commented
Mar 3, 2026
...tures/Core/Portable/Diagnostics/Service/DiagnosticAnalyzerService_RemoteOrLocalDispatcher.cs
Show resolved
Hide resolved
Member
Author
|
@jasonmalinowski Ready for another look |
src/VisualStudio/Core/Def/TaskList/VisualStudioDiagnosticIdCache.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/VisualStudioDiagnosticIdCache.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/VisualStudioDiagnosticIdCache.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/TaskList/VisualStudioDiagnosticIdCache.cs
Outdated
Show resolved
Hide resolved
e635be4 to
cac9a4b
Compare
|
|
||
| internal class VisualStudioDiagnosticIdCache : IWorkspaceService | ||
| { | ||
| // This dictionary maps ProjectIds to a descriptor list. |
jasonmalinowski
approved these changes
Mar 3, 2026
Member
jasonmalinowski
left a comment
There was a problem hiding this comment.
Comments are not blocking,
.
| /// Map from project ID to all the possible analyzer diagnostic IDs that can be reported in the project. | ||
| /// </summary> | ||
| private ImmutableDictionary<ProjectId, AsyncLazy<ImmutableHashSet<string>>> _allDiagnosticIdMap = ImmutableDictionary<ProjectId, AsyncLazy<ImmutableHashSet<string>>>.Empty; | ||
| private readonly VisualStudioDiagnosticIdCache _diagnosticIdCache = solution.Workspace.Services.GetRequiredService<VisualStudioDiagnosticIdCache>(); |
Member
There was a problem hiding this comment.
It may be a practical question of whether this line is doing much -- I assume we create new InProgressStates, and this will force the cache to be initialized earlier; in a CPS-project only solution we'll fetch this and then never use it.
Member
There was a problem hiding this comment.
And if we delete that then this InProgressState type might have no reason to exist either, but that's a follow-up.
Member
Author
|
/backport to release/insiders |
Contributor
|
Started backporting to |
Merged
2 tasks
phil-allen-msft
pushed a commit
that referenced
this pull request
Mar 3, 2026
… is not supported (#82613) Backport of #82508 to release/insiders The underlying issue is that we never reported that there were errorIds we didn't support. We would then only report compiler errors. This mean analyzer diagnostics and build errors went unreported. This PR adds a in-process cache of supported diagnostics ids and we now throw NotImplementedException when we know for certain we do not support the errorId. In cases where our cache is not populated and we cannot say that the errorId is unsupported we will report it. ## Customer Impact ## Regression - [x] Yes - [ ] No See https://github.com/dotnet/roslyn/pull/79915/changes#r2277979495 ## Testing Tests were added as well as manual testing. ## Risk Low - Even in cases where the cache fails and never populates, we would still report the errors such that they are shown in the Error List. --------- Co-authored-by: Joey Robichaud <jorobich@microsoft.com>
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.
In #79964 we removed a check for whether a non-compiler build error should be reported to the Error List. This PR restores that check. It also adds an in-process cache of diagnostic descriptors so that it can synchronously determine whether a diagnostic id is supported.
Fixes #81109
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2695780