Verify that a key is in the warningsAsErrors dictionary before using it#6269
Merged
benvillalobos merged 1 commit intodotnet:mainfrom Mar 16, 2021
Merged
Verify that a key is in the warningsAsErrors dictionary before using it#6269benvillalobos merged 1 commit intodotnet:mainfrom
benvillalobos merged 1 commit intodotnet:mainfrom
Conversation
benvillalobos
approved these changes
Mar 16, 2021
Member
benvillalobos
left a comment
There was a problem hiding this comment.
Thanks for the quick patch.
| int key = GetWarningsAsErrorOrMessageKey(context); | ||
|
|
||
| HashSet<string> warningsAsErrorsExcludingMessages = new HashSet<string>(_warningsAsErrorsByProject[key]); | ||
| if (!_warningsAsErrorsByProject.TryGetValue(key, out ISet<string> warningsAsErrorsExcludingMessages)) |
Member
There was a problem hiding this comment.
I was going to suggest checking !_warningsAsErrorsByProject.ContainsKey(key), but containskey actually calls trygetvalue.
Member
|
Related issue: dotnet/sdk#16350 |
AR-May
approved these changes
Mar 16, 2021
Member
|
@Forgind @benvillalobos should this fix be in We still hit this here: dotnet/maui-samples#111 Log: Release.zip |
Contributor
Author
|
@rokonec pointed out that there were two places that could have had the problem, and that fix happened to be the right one for the person who originally reported the problem. I suspect your problem would be resolved by #6304, but @benvillalobos suggested we should wait and merge #6308 instead. |
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.
Customers reported issues like:
Looking at it, we access a dictionary here without verifying that the key (project ID) is in the dictionary. This fixes that and defaults to "no warnings as errors" if relevant.
Currently untested.