-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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/8.0-staging] Fix compilation error with generic type attributes #97717
[release/8.0-staging] Fix compilation error with generic type attributes #97717
Conversation
Strip generic type parameter attributes from partial classes emitted by the logging source generated to avoid CS0579 errors from duplicate attributes. Fixes #97498.
Update comment as suggested by code review.
Verify that attributes on generic type parameters are not lost.
Tagging subscribers to this area: @dotnet/area-extensions-logging Issue DetailsBackport of #97613 to release/8.0-staging Customer Impact
[Select one or both of the boxes. Describe how this issue impacts customers, citing the expected and actual behaviors and scope of the issue. If customer-reported, provide the issue number.] Regression
[If yes, specify when the regression was introduced. Provide the PR or commit if known.] Testing[How was the fix verified? How was the issue missed previously? What tests were added?] Risk[High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.] IMPORTANT: If this backport is for a servicing release, please verify that:
|
@@ -5,6 +5,8 @@ | |||
<EnableDefaultItems>true</EnableDefaultItems> | |||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |||
<IsPackable>true</IsPackable> | |||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> |
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.
@ericstj @carlossanlop could you please verify this package authoring?
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.
LGTM
CC @artl93 |
This is approved offline. |
Backport of #97613 to release/8.0-staging
/cc @tarekgh @martincostello
Customer Impact
Users who employ the logging source generator and define the logger message method within a class featuring generic type parameters and applied attributes like
public partial class Greeter<[Foo] T>
will encounter a compilation error. Resolving this issue is not straightforward, and workarounds may prove challenging. While this problem doesn't stem from a regression in the latest release, it poses a significant obstacle for users aiming to build for Aot, given that Aot relies on these attributes. Here is a user report in their own words #97613 (comment)Regression
Testing
Manually verified, added new tests, and passed all regression tests.
Risk
The impact is minimal; the modification specifically addresses the scenario when emitting the partial class name to prevent the compilation error. This alteration is isolated and shouldn't have any adverse effects on other aspects.
IMPORTANT: If this backport is for a servicing release, please verify that:
The PR target branch is
release/X.0-staging
, notrelease/X.0
.If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.