Repository navigation
Do not attempt to move diagnostics with additional locations. - #10302
Merged
CyrusNajmabadi merged 3 commits intoApr 5, 2016
Merged
Conversation
| return diagnostic.AdditionalLocations == null || diagnostic.AdditionalLocations.Count == 0; | ||
| } | ||
|
|
||
| private static async Task<ImmutableArray<DiagnosticData>> UpdateAllSemanticDiagnostics(StateSet stateSet, DiagnosticAnalyzerDriver analyzerDriver, ImmutableArray<DiagnosticData> diagnosticData) |
Contributor
|
Tagging @heejaechang so the v2 OOP engine also handles this. |
Contributor
Author
|
Ping @dotnet/roslyn-ide |
Contributor
|
Can you point us at the PR that contains the internal tests? |
Contributor
Author
Contributor
Author
|
test vsi please |
Contributor
|
👍 |
|
|
||
| diagnosticData = _owner.UpdateDocumentDiagnostics(existingData, ranges.Ranges, memberDxData.AsImmutableOrEmpty(), root.SyntaxTree, member, memberId); | ||
| ValidateMemberDiagnostics(stateSet.Analyzer, document, root, diagnosticData); | ||
| // if all the current diagnostics have all their locations in this document, |
Contributor
There was a problem hiding this comment.
I think this method shouldn't be called for analyzer that can't do member update. just make the analyzer never to be in this method.
Contributor
There was a problem hiding this comment.
hmmm.. this code seems changed quite a bit over what I remember. anyway, v2 engine doesn't make span based analysis anymore so it shouldn't be an issue for v2.
Contributor
|
👍 |
Contributor
Author
|
retest vsi please |
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.
Fixes #10258
The issue here is that the "InvokeDelegateWithConditionalAccess" analyzer uses 'additional locations' on diagnostic datas to pass along data. Unfortunately, the diagnostic analyzer infrastructure was not properly updating these spans when it attempted to preserve and move around diagnostics.
Updating these diagnostics is tricky to do properly. Additional locations can span across documents or may be in arbitrary locations in the same docoument as the diagnostic. As such, if have those diagnostics, we don't try to reuse and move the owning diagnostics. Instead, we reacquire these diagnostics so that all the data in them is correct.
Because of the complexity of this repro the testing will be done with an integration test in roslyn-internal.