-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[libs][mono] Prevent static constructor from referencing Internal.Runtime.Augments.DynamicDelegateAugments
in build scenarios without linking
#90519
Conversation
…ivate API in scenarios without app linking
Tagging subscribers to this area: @cston Issue DetailsThis PR fixes a regression introduced with unifying the The regression was noticed in libraries tests failures on The tests are failing due to the fact that This has been fixed by guarding a reference to the private API that only NativeAOT implements preventing static constructor to throw Fixes #90494
|
/cc: @rolfbjarne @SamMonoRT @vargaz |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/DelegateHelpers.cs
Outdated
Show resolved
Hide resolved
…ghtup private API in scenarios without app linking" This reverts commit 6f8b3e8.
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/DelegateHelpers.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
It would be great if we could get this fix in before RC1 snap. |
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/DelegateHelpers.cs
Outdated
Show resolved
Hide resolved
…/DelegateHelpers.cs
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/DelegateHelpers.cs
Outdated
Show resolved
Hide resolved
…/DelegateHelpers.cs
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/DelegateHelpers.cs
Show resolved
Hide resolved
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
This is the same situation on CoreCLR. Is the difference here that CoreCLR won't run the |
I assume that it is the case. There are situations where Mono runs beforefieldinit static constructors even when the field is not accessed. It is tracked by #88066 and related bugs. |
The CI build shows that the regression has been fixed. Thanks everyone for your help, feedback and suggestions. Taking into account the RC1 snap deadline and the amount of time required for |
This PR fixes a regression introduced with unifying the
System.Linq.Expressions
library build in #88723 when targeting iOS-like platforms without linking (no trimming) with Mono.The regression was noticed in libraries tests failures on
tvos-arm64
reported here: #90494 which are configured not to perform any trimming during the app build.The tests are failing due to the fact that
DynamicDelegateLightup
as a type is not trimmed away during library build time (as it previously was before unification), and since the trimming is disabled during app (libraries tests) build time ends up in the final executable. This further cause a problem at runtime because Mono tries to initialise a type which references a type/method which is only implemented by NativeAOT:Internal.Runtime.Augments.DynamicDelegateAugments
https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/DynamicDelegateAugments.csThis has been fixed by guarding a reference to the private API that only NativeAOT implements preventing static constructor to throw
TypeInitializationException
Fixes #90494