Warning CS8123 is misleading if there is no element name in the target type #18169
Labels
Area-Compilers
Concept-Diagnostic Clarity
The issues deals with the ease of understanding of errors and warnings.
Resolution-Fixed
The bug has been fixed and/or the requested behavior has been implemented
Milestone
Version Used: 2.0.0.61501
Steps to Reproduce:
Compile this code:
Expected Behavior:
A warning along the lines of:
Actual Behavior:
The actual error message is misleading because a different name isn't specified - instead, no name is specified.
It's fine for this to be a warning, but it would be nice if the message were clearer. Unfortunately my guess is that in order to have a different message between this and the situation where there really is a different name, they have to be different warning numbers - and that may count as a breaking change. (I'm not sure what the C# team policy is there.) In that case, we might need a single warning message that covers both situations. For example:
That's definitely not as nice as having two different warnings though, IMO.
The text was updated successfully, but these errors were encountered: