Disable EventSource for Apple mobile NativeAOT test libraries - #130675
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b951d28-c99d-4820-9a3d-dbd6fa51fc74
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
There was a problem hiding this comment.
Pull request overview
This PR adjusts how library test projects opt into EventSourceSupport so that Apple mobile NativeAOT scenarios don’t end up enabling EventSource/EventPipe support in a way that can cause problematic startup behavior, and it scopes a NetEventSource metadata assertion to avoid known NativeAOT+Apple mobile limitations.
Changes:
- Gate
EventSourceSupportinSystem.Runtime.CachingandSystem.Net.Primitivestest csprojs behind$(TestNativeAot). - Skip
LoggingTest.EventSource_ExistsWithCorrectIdunder NativeAOT + Apple mobile viaActiveIssue.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching.Tests.csproj | Makes EventSourceSupport conditional on TestNativeAot for the test project. |
| src/libraries/System.Net.Primitives/tests/FunctionalTests/System.Net.Primitives.Functional.Tests.csproj | Makes EventSourceSupport conditional on TestNativeAot for the functional tests project. |
| src/libraries/System.Net.Primitives/tests/FunctionalTests/LoggingTest.cs | Skips the EventSource metadata assertion on NativeAOT + Apple mobile via ActiveIssue. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
jkotas
left a comment
There was a problem hiding this comment.
The EventSource metadata assertion is skipped only when both NativeAOT and Apple mobile are active, consistent with #91762.
This does not sound right. #91762 is about dealing with multiple event pipe instances in the same process that occurs with shared libraries. It is not the case here. These Apple mobile tests should only ever load a single instance of the runtime in given process.
EventSource registration in a static NativeAOT library can recurse through EventPipe exception handling and exhaust the stack during startup
What is the stacktrace of this recursion? This recursion is likely a product bug that should be fixed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b951d28-c99d-4820-9a3d-dbd6fa51fc74
You are right, based on the .binlog the host build compiled the NativeAOT test library with EventSourceSupport=true, but ProxyProjectForAOTOnHelix.proj evaluated it as false and linked libeventpipe-disabled.a. Then EventPipeInternal_CreateProvider returned zero, and EventPipeEventProvider.Register threw OutOfMemoryException I removed the test-level EventSource changes. The revised fix passes EventSourceSupport and _SuppressNativeLibEventSourceWarning into the helix proxy. |
|
/azp run runtime-ioslike |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5c7bdbc-1820-4b8b-bd95-fa27a6781103
|
/azp run runtime-ioslike |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
The System.Net.Primitives startup crash is fixed |
Description
This disables EventSource support for the
System.Net.PrimitivesandSystem.Runtime.Cachingtest libraries when Apple mobile NativeAOT assignsTestNativeAotafter project evaluation. EventSource registration in a static NativeAOT library can recurse through EventPipe exception handling and exhaust the stack during startup, as seen in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1507526. Desktop NativeAOT builds still enable EventSource because they setTestNativeAotbefore project evaluation. The EventSource metadata assertion is skipped only when both NativeAOT and Apple mobile are active, consistent with #91762.