-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Attributes taking object as a parameter have unexpected behavior in AOT #100688
Labels
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection |
dotnet-policy-service
bot
added
the
untriaged
New issue has not been triaged by the area owner
label
Apr 5, 2024
I was able to validate (on .NET 8) that on CoreCLR this behaves as expected. On NativeAOT it does reproduce the wrong behavior (converting the values to Int32). |
phil-scott-78
added a commit
to phil-scott-78/spectre.console
that referenced
this issue
Apr 5, 2024
Enums are converted to integers with NativeAOT on attribute constructors. This work around is needed until that bug is fixed. See dotnet/runtime#100688
MichalStrehovsky
added a commit
that referenced
this issue
Apr 16, 2024
) Fixes #100688 Fixes a bit more than just what was reported (see the test). We were losing type information in `attribute.DecodeValue` and could no longer distinguish between `new object[] { SomeEnum.Val }` and `new SomeEnum[] { SomeEnum.Val }`. The fix required a complete rewrite of attribute emission using the more low level API. Cc @dotnet/ilc-contrib
dotnet-policy-service
bot
removed
the
untriaged
New issue has not been triaged by the area owner
label
Apr 16, 2024
phil-scott-78
added a commit
to phil-scott-78/spectre.console
that referenced
this issue
Apr 18, 2024
Enums are converted to integers with NativeAOT on attribute constructors. This work around is needed until that bug is fixed. See dotnet/runtime#100688
matouskozak
pushed a commit
to matouskozak/runtime
that referenced
this issue
Apr 30, 2024
…et#100763) Fixes dotnet#100688 Fixes a bit more than just what was reported (see the test). We were losing type information in `attribute.DecodeValue` and could no longer distinguish between `new object[] { SomeEnum.Val }` and `new SomeEnum[] { SomeEnum.Val }`. The fix required a complete rewrite of attribute emission using the more low level API. Cc @dotnet/ilc-contrib
Ruihan-Yin
pushed a commit
to Ruihan-Yin/runtime
that referenced
this issue
May 30, 2024
…et#100763) Fixes dotnet#100688 Fixes a bit more than just what was reported (see the test). We were losing type information in `attribute.DecodeValue` and could no longer distinguish between `new object[] { SomeEnum.Val }` and `new SomeEnum[] { SomeEnum.Val }`. The fix required a complete rewrite of attribute emission using the more low level API. Cc @dotnet/ilc-contrib
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
Given an attribute that take an
object
as a parameter, when using an Enum it gets converted to anint
before being passed to the constructor during AOTReproduction Steps
Expected behavior
Actual behavior
Regression?
Not sure
Known Workarounds
For custom attributes, using a generic attribute will now work. But that doesn't help when wanting to use an existing one like
DefaultAttribute
Configuration
Not sure
Other information
No response
The text was updated successfully, but these errors were encountered: