Fix the ability to expand the list of analyzers in a reference#49574
Merged
1 commit merged intodotnet:masterfrom Nov 23, 2020
Merged
Fix the ability to expand the list of analyzers in a reference#495741 commit merged intodotnet:masterfrom
1 commit merged intodotnet:masterfrom
Conversation
This was broken by 7fa2c96, where I asserted that GetDiagnosticItems was only called when we already knew we would have items. This was broken since right before we called the method the collection would get created, which changed the answer it would return. A small refactoring ensures we create the list and fill it in at once. This also makes it clear we aren't passing a non-trivial LINQ query across method boundaries anyways in a way that might result in multiple enumerations. Fixes dotnet#49524
jasonmalinowski
commented
Nov 23, 2020
| @@ -110,7 +109,9 @@ private IEnumerable<BaseDiagnosticItem> GetDiagnosticItems(string language, Comp | |||
|
|
|||
| Contract.ThrowIfFalse(HasItems); | |||
Member
Author
There was a problem hiding this comment.
This was the problematic assert: conceptually the idea was "we shouldn't be trying to create items if we know we don't have any to show", but in the code prior to this new change we would assign the field before calling GetDiagnosticItems, so HasItems would instead return false because we had realized the list prematurely.
mavasani
approved these changes
Nov 23, 2020
sharwell
approved these changes
Nov 23, 2020
|
Hello @jasonmalinowski! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This pull request was closed.
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.
This was broken by 7fa2c96, where I asserted that GetDiagnosticItems was only called when we already knew we would have items. This was broken since right before we called the method the collection would get created, which changed the answer it would return. A small refactoring ensures we create the list and fill it in at once. This also makes it clear we aren't passing a non-trivial LINQ query across method boundaries anyways in a way that might result in multiple enumerations.
Fixes #49524