-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Tons of errors if building for AOT (IL3050) #1831
Comments
Suppressing IL3050 shows me another one:
|
Can you try v0.12.11 ? |
Thanks a lot for your quick response. |
Are you able to create a small repro? I'm not seeing it on my machine |
Any tip on how can i see the generated code ? It seems that after the error I can't see it on disk the offending path on the error. |
You can see generated code by placing this in your csproj and rebuilding:
|
I scope down the problem to this:
} Removing or adding the enum CustomKey make the problem appear/disappear. It seems that the type even if not being used cause the code generation |
I can see the code generated file but no reference into Enum.GetValues() |
I still can't reprocate it |
Attached a trivial project with TUnit that generate warning IL3050 C:\Users\rodrigov\source\repos\TUnitTest>dotnet publish -c Debug -r win-x64 Build succeeded with 5 warning(s) in 25.3s C |
@rodrigovaras can you try v0.13.15 |
@thomhurst i'm impressed on your excellent support. I move into 0.13.5 and all the other warnings disappear, but now the ILC build setps is giving me 2 new errors: I assume this can't be reproduced by the simple .zip project I send it before it seems that my more elaborated project reveal the problem. Another similar project on my solution that has AOT enabled also complain on the same issue. |
I'm porting many xUnit test into TUnit for the whole purpose of enabling AOT testing.
When I build my unit test for AOT i get many msbuild errors (that can be supressed) like this:
Binding.Model net9.0 succeeded (0.4s) → artifacts\bin\Binding.Model\debug_net9.0\Teksoft.Binding.Model.dll
Binding.Core net9.0 succeeded (0.5s) → artifacts\bin\Binding.Core\debug_net9.0\Teksoft.Binding.Core.dll
Binding.Mock.Test succeeded (0.2s) → artifacts\bin\Binding.Mock.Test\debug\Teksoft.Binding.Mock.Test.dll
Binding.Core.Test failed with 153 error(s) (33.6s) → test\artifacts\bin\Binding.Core.Test\debug_win-x64\Teksoft.Binding.Core.Test.dll
ILC : AOT analysis error IL3050: TUnit.SourceGenerated.<BindingTest_06054ffcd3014f66b2e6a48ef6c3dd64_Generated>F56AB95644891240B5A9CDB79558D9E1D87B85B2920919123C46334919BE9EEA4__BindingTest.<>c__DisplayClass2_1.b__0(): Using member 'System.Enum.GetValues(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. It might not be possible to create an array of the enum type at runtime. Use the GetValues overload or the GetValuesAsUnderlyingType method instead.
ILC : AOT analysis error IL3050: TUnit.SourceGenerated.<BindingTest_a35d90e75525436994564935f5a0d5a8_Generated>F570D2CCCFB64BDB85DD9E28A7353E4C7CED39F399E1BB4761E7F1A3AA04086B1__BindingTest.<>c__DisplayClass2_1.b__0(): Using member 'System.Enum.GetValues(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. It might not be possible to create an array of the enum type at runtime. Use the GetValues overload or the GetValuesAsUnderlyingType method instead
I suspect it could be caused by TUnit generated code ?
Would be great to fix this for AOT generation.
Using .NET 9
The text was updated successfully, but these errors were encountered: