Allow external warnings to use codes >= 6001#1609
Merged
mateoatr merged 5 commits intodotnet:masterfrom Nov 6, 2020
Merged
Conversation
Ignore in mono
vitek-karas
requested changes
Nov 5, 2020
rolfbjarne
reviewed
Nov 6, 2020
vitek-karas
reviewed
Nov 6, 2020
added 2 commits
November 6, 2020 10:02
vitek-karas
approved these changes
Nov 6, 2020
marek-safar
reviewed
Nov 6, 2020
| /// <returns>Custom MessageContainer of 'Error' category</returns> | ||
| public static MessageContainer CreateCustomErrorMessage (string text, int code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) | ||
| { | ||
| var callingAssembly = Assembly.GetCallingAssembly (); |
marek-safar
reviewed
Nov 6, 2020
| var callingAssembly = Assembly.GetCallingAssembly (); | ||
| #if DEBUG | ||
| Debug.Assert (!(Assembly.GetCallingAssembly () == typeof (MessageContainer).Assembly), | ||
| "Internal error: 'CreateCustomErrorMessage' is intended to be used by external assemblies only. Use 'CreateErrorMessage' instead."); |
Contributor
There was a problem hiding this comment.
No need to prefix Assert with Internal error:
marek-safar
reviewed
Nov 6, 2020
| { | ||
| var callingAssembly = Assembly.GetCallingAssembly (); | ||
| #if DEBUG | ||
| Debug.Assert (!(Assembly.GetCallingAssembly () == typeof (MessageContainer).Assembly), |
Contributor
There was a problem hiding this comment.
You could just use != instead
marek-safar
reviewed
Nov 6, 2020
| "Internal error: 'CreateCustomWarningMessage' is intended to be used by external assemblies only. Use 'CreateWarningMessage' instead."); | ||
| #endif | ||
| if (code <= 6000) | ||
| throw new ArgumentException ($"The provided code '{code}' does not fall into the permitted range for external warnings. To avoid possible collisions " + |
Contributor
There was a problem hiding this comment.
Should be ArgumentOutOfRangeException
mateoatr
added a commit
that referenced
this pull request
Nov 9, 2020
agocke
pushed a commit
to dotnet/runtime
that referenced
this pull request
Nov 16, 2022
* Allow external warnings and errors to have codes >= 6001 * Fix whitespace formatting Ignore in mono * Add CreateCustomWarningMessage * Fix assert * Fix formatting Commit migrated from dotnet/linker@ebc6155
agocke
pushed a commit
to dotnet/runtime
that referenced
this pull request
Nov 16, 2022
* Follow up * Add parameter to exception * Fix formatting Commit migrated from dotnet/linker@1ce464d
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 #1596.
/cc @rolfbjarne