-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/6.0] Fix Logging source generator failures with various syntax #64779
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-logging Issue DetailsRecently we added a few post 6.0 bug fixes to main branch. This PR is cherry picking the following ones:
Customer ImpactBugfix in PR #64663 was the most requested by community as part of post release 6.0 feedback so would be good to backport it to 6.0. Also, the bugfix in PR helps with the logging source generator robustness and to developers wanting to migrate to the new logging approach fixes a variety of use cases having to do with constraints. TestingThe PRs have combined test use cases with them. Risk
|
… / when dealing with constraints (dotnet#64593) * Fixes some logging source gen bugs: - Supports usage of "in" modifier - Improves support for generic constraints Fixes dotnet#58550, dotnet#62644 * Apply PR feedback * Add another test
…ters (dotnet#64663) * Adds support to `@` signed prefixed parameters Fixes dotnet#60968 * Move repetitive logic to a new property * Remove NeedsAtSign
aab4f8c
to
124c7c1
Compare
To make things clear for tactics and servicing, I only am keeping this one release/6.0 PR for logging source generator improvements. |
124c7c1
to
cb38fc7
Compare
Typically this is not preferred. It makes things a bit harder since it becomes an all or nothing decision to take the PR. The commits are also not independently revertible. I think here we can say these are all low risk changes and we kept them together to avoid merge conflicts with each other. |
This received tactics approval. I think it should be OK to merge |
Approved over mail |
Failures are unrelated. We can merge this one (got approval offline). |
@safern Missing assignment of .NET 6.0 milestone ? (Since merged into |
Customer Impact
Presenting 3 customer-reported issues, being blocked from using the Logging Source Generator when using the following use cases below. (Workarounds require customers to significantly change their usage which prevents them from adopting the feature).
If a C# keyword is used as a parameter name for a
[LoggerMessage]
method using the logging source generator prefixed with an@
, such as the example below, the application will fail to compile due to the source generator creating invalid C#.If the
@
is included in the template to match the parameter, it will also fail to compile.For example, as originally reported, the generator fails to compile due to CS0246 and CS0265 errors if type for generic constraint is in a different namespace. There's more constraint-related use cases covered within the PR.
in
parameter modifier is present #62644 helps with the logging source generator support thein
orref
modifier, rather than producing a compile failure with the repro sample seen below:Regression
No
Testing
Automated test cases added to cover the missed syntax. Included in the PRs:
@
signed prefixed parameters #64663Risk
Low. Very targeted changes were selected to handle missed syntax.
Test cases were added and more variants to reported repro cases were also explored.
When fixing for generic constrains, we reduced risk by avoiding duplication of constraints/derived types.
The other two fixes (
ref
/in
support and@
prefixed parameter support) only impact use cases for which we are otherwise unsupported and produce ambiguous compilation errors, has also been reviewed by Roslyn members and therefore are clear improvements with low risk.Packaging impact:
Ref pack impact:
Yes, modifies inbox source-generator contained in ASP.NET ref-pack.