-
Notifications
You must be signed in to change notification settings - Fork 841
Fix METGEN004 error message: print return type in ErrorInvalidMethodReturnType
#6905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix METGEN004 error message: print return type in ErrorInvalidMethodReturnType
#6905
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the METGEN004 error message to include the actual return type when reporting invalid method return types in the metrics generator. The change improves diagnostics by displaying the problematic return type (e.g., void, object, int) instead of just the method name.
- Updates error diagnostic to show the return type using minimally qualified format
- Adds test coverage to verify the error message includes the return type
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Generators/Microsoft.Gen.Metrics/Parser.cs | Modified error diagnostic to include return type in message instead of method name |
| test/Generators/Microsoft.Gen.Metrics/Unit/ParserTests.cs | Added test assertion to verify error message contains the return type |
Alt impls:
returnType.Namewould returnVoid,Object,Int32instead ofvoid,objectandint.SymbolDisplayFormat.MinimallyQualifiedFormatwould return the fully qualified name (i.e.Namespace.OuterClass.InnerClass).Fixes #6719
Microsoft Reviewers: Open in CodeFlow