You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generic test class property metadata emits dynamic getters during Native AOT publishing #7499
Public instance properties on generic test classes generate metadata getters using dynamic. Native AOT publishing consequently reports IL2026 and IL3050 for those getters, even when the test itself uses only statically typed code. Property metadata should be accessible without requiring runtime code generation.
Reproduction
At main commit 374bb7c, src/TUnit.Core.SourceGenerator/Utilities/MetadataGenerationHelper.cs:363 emits o => ((dynamic)o).Property for generic classes. Add this fixture to a test application:
Publish with dotnet publish -c Release -p:Aot=true --use-current-runtime -f net10.0 in tests/TUnit.TestProject. The required-property fixture introduced by #7496 also reproduces the warnings.
Expected and actual
Expected: metadata getters for a closed generic test class use an AOT-compatible access path.
Actual: generated property getter delegates call Microsoft.CSharp.RuntimeBinder.Binder.GetMember and CallSite.Create, reporting IL2026 and IL3050 because dynamic requires runtime code generation.
Environment
.NET SDK 10.0.403; net10.0; macOS arm64. Confirmed the dynamic getter emission remains on origin/main.
Please generate AOT-compatible getters for generic test class property metadata.
Activity
Fix AOT-compatible generic property metadata getters (#7499) (#7524)