Skip to content

[ci-fix] Needs review: deploy FileVersionInfo TestAssembly as Content on Apple NativeAOT (refs #130253) - #130328

Merged
kotlarmilos merged 6 commits into
mainfrom
ci-fix/130253-fileversioninfo-nativeaot-testasset-2f516b5b88683d2d
Jul 10, 2026
Merged

[ci-fix] Needs review: deploy FileVersionInfo TestAssembly as Content on Apple NativeAOT (refs #130253)#130328
kotlarmilos merged 6 commits into
mainfrom
ci-fix/130253-fileversioninfo-nativeaot-testasset-2f516b5b88683d2d

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Workflow artifact: ci-fix
Artifact kind: help
Linked KBE: #130253

Important

Help-wanted / needs-review draft. This is a best-effort candidate fix that I could not build-validate in the agent environment (no Apple NativeAOT cross-build is available here). It is a genuine, non-muting change — it does not disable, skip, or [ActiveIssue] the test. Please validate on the Apple NativeAOT library-test legs before merging.

Root cause

On the Apple NativeAOT library-test legs (iossimulator / maccatalystAllSubsets_NativeAOT, e.g. build 1494308), System.Diagnostics.Tests.FileVersionInfoTest.FileVersionInfo_CustomManagedAssembly fails with:

System.IO.FileNotFoundException : .../System.Diagnostics.FileVersionInfo.Tests.app/System.Diagnostics.FileVersionInfo.TestAssembly.dll

The test opens its companion assembly by file path to read PE version metadata — it never loads or executes it (FileVersionInfoTest.cs:25):

VerifyVersionInfo(Path.Combine(Directory.GetCurrentDirectory(),TestAssemblyFileName), ...);// TestAssemblyFileName = "System.Diagnostics.FileVersionInfo.TestAssembly.dll"

In the test .csproj, for Apple mobile the TestAssembly was included as a plain <ProjectReference>. Under NativeAOT that assembly is compiled into the native image, so no loose .dll is deployed next to the app and Directory.GetCurrentDirectory()/...TestAssembly.dll does not exist → FileNotFoundException. Under Apple Mono the managed assembly is still deployed as a file, which is why the test passes there.

The existing [ActiveIssue(".../124344", IsAppleMobile && IsCoreCLR)] on this test does not apply here: PlatformDetection.IsCoreCLR => IsNotMonoRuntime && IsNotNativeAot is false under NativeAOT, so the test genuinely runs (and fails) on the NativeAOT leg.

These NativeAOT library tests on Apple mobile were newly enabled by #125437.

Candidate change

Deploy the TestAssembly as a Content data file on the Apple NativeAOT leg (exactly as already done for desktop), while keeping the plain project reference for Apple Mono, where the #46856 vfs-mapping workaround still applies:

  • TargetsAppleMobile && UseNativeAotRuntime → Content copy (new).
  • TargetsAppleMobile && !UseNativeAotRuntime (Mono) → plain reference (unchanged).
  • Browser and desktop → unchanged.

Only the Apple-NativeAOT branch changes; the MSBuild conditions leave Mono Apple, browser, and desktop provably untouched, and never select both <ProjectReference> items at once.

What is unverified (why this is a draft)

  • I could not run an Apple NativeAOT build here, so I have not confirmed the Content .dll actually lands at Directory.GetCurrentDirectory() inside the NativeAOT .app bundle, nor that the AppleAppBuilder NativeAOT library-mode path packages Content identically to Mono.
  • Reasoning it should work: sibling Content files in this project (NativeLibrary.dll, NativeConsoleApp.exe) are already deployed and found on Apple, and under NativeAOT there is no managed-assembly vfs mapping for [wasm][aot] build tries to cross compile unrelated dlls from the publish folder #46856 to collide with — but this needs a CI run to confirm.

Validation

  • Build-validated: No — Apple NativeAOT cross-build is not available in the agent environment.
  • Requested: run System.Diagnostics.FileVersionInfo.Tests on the iossimulator / maccatalystAllSubsets_NativeAOT legs and confirm FileVersionInfo_CustomManagedAssembly passes with no identical vfs mappings packaging error.

Suggested reviewers / area contacts

These tests were enabled on Apple NativeAOT by #125437@kotlarmilos, could you (or the mobile/NativeAOT folks) confirm the Content asset is bundled at the app's working directory under NativeAOT library mode? Area owners: @dotnet/area-system-diagnostics.

Note

This PR was generated by an AI/Copilot agent (ci-failure-fix) as a best-effort, non-muting candidate fix. Please review carefully before merging.

Note

🔒 Integrity filter blocked 17 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #128501search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #104998search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #104750search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #97491search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #76276search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #78999search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #76417search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #69571search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #62435search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #61444search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #35376search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #193search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #34218search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #38914search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #44747search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • [ci-scan] Test failure: System.Threading.Tests.MutexTests.CrossProcess_NamedMutex_ConcurrentCreateOrOpen #130125issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • ... and 1 more item

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
github:
min-integrity: approved # merged | approved | unapproved | none

Generated by CI Outer-Loop Failure Fixer · ● 9.3M ·

FileVersionInfo_CustomManagedAssembly opens the companion
System.Diagnostics.FileVersionInfo.TestAssembly.dll by file path to read
its PE version metadata. On Apple mobile NativeAOT the test assembly was
referenced via a plain ProjectReference, so it is compiled into the native
image and no loadable .dll is deployed next to the app, causing the test to
throw FileNotFoundException.
Deploy the assembly as a Content data file on the Apple NativeAOT leg (as is
already done for desktop), while keeping the plain project reference for
Apple mobile Mono where the #46856 vfs-mapping workaround still applies.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Apple app bundler strips managed .dll files from NativeAOT app bundles, so
the test asset deployed as Content reaches publish/ but not the app working
directory, and FileVersionInfo_CustomManagedAssembly throws FileNotFoundException.
Redeploy the read-only PE asset under a bundle-safe .exe name before bundling and
read that name on Apple NativeAOT. Verified on the iossimulator-arm64 NativeAOT
leg: the test now passes in the simulator.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichalStrehovsky

Copy link
Copy Markdown
Member

The workarounds for broken tooling (crossgen2, apple app builder, whatever is the problem on browser) are getting out of hand here.

If we don't want to fix the tools not to consider random Content as code (which it looks like we don't), we should instead embed the project as a resource and write it out to TEMP. This test is already writing to TEMP.

Something along the lines of:

 <ProjectReferenceInclude="FileName.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>EmbeddedResource</OutputItemType>
<LogicalName>Filename.dll</LogicalName>
</ProjectReference>

will embed the assembly as Filename.dll in managed resources. Then it can be dumped to TEMP and inspected. And all the workarounds deleted, instead of adding yet another axis of workarounds.

@kotlarmilos

Copy link
Copy Markdown
Member

The workarounds for broken tooling (crossgen2, apple app builder, whatever is the problem on browser) are getting out of hand here.

If we don't want to fix the tools not to consider random Content as code (which it looks like we don't), we should instead embed the project as a resource and write it out to TEMP. This test is already writing to TEMP.

Something along the lines of:

 <ProjectReference Include="FileName.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>EmbeddedResource</OutputItemType>
<LogicalName>Filename.dll</LogicalName>
</ProjectReference>

will embed the assembly as Filename.dll in managed resources. Then it can be dumped to TEMP and inspected. And all the workarounds deleted, instead of adding yet another axis of workarounds.

I agree, most of the mobile failures are infra related or caused by incorrect test packaging. I will try to keep the changes minimal and avoid introducing more complexity. Alternatively, I suggest disabling such tests.

…g it
Per review feedback, replace the per-platform Content and project-reference
workarounds with a single embedded managed resource that FileVersionInfoTest
writes to a temp file and inspects. This removes the Browser and Apple mobile
special-casing for #46856, the ReadyToRun exclude, the Mono
trimming descriptor, and the Apple NativeAOT .exe redeploy, since no loose
managed .dll is deployed on any platform.
Verified on the iossimulator-arm64 NativeAOT leg: FileVersionInfo_CustomManagedAssembly
passes in the simulator.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-servicedotnet-policy-serviceBot added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 8, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmiloskotlarmilos self-assigned this Jul 8, 2026
The test previously loaded the asset from a Content-deployed file, which
failed on Apple mobile CoreCLR and was disabled via the issue #124344
ActiveIssue. The test now reads the assembly from an embedded resource and
writes it to a temp file at run time, so the Apple mobile CoreCLR filter is
no longer required. CI verifies the test passes on the Apple mobile legs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

kotlarmilos added a commit to kotlarmilos/runtime that referenced this pull request Jul 9, 2026
Replace the previous .exe redeploy workaround with the approach from dotnet#130328,
extended to also cover FileVersionInfo_EmptyFVI. Embed the test assembly and
Assembly1.cs as managed resources and write them to a temp file at run time,
so the tests do not depend on those files being deployed next to the test app.
On NativeAOT Apple mobile the app bundler strips managed .dll files from the
.app bundle, which is why the loose files were missing. This removes the
platform-specific Content, ProjectReference, ReadyToRun and trimming
special-casing and drops the related [ActiveIssue] skips.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos
kotlarmilos marked this pull request as ready for review July 9, 2026 15:06

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the System.Diagnostics.FileVersionInfo tests to stop relying on a companion managed test assembly being deployed as a loose .dll file, by embedding that assembly into the test binary and extracting it to a temp file at runtime (to support scenarios like Apple NativeAOT where the .dll may not exist on disk).

Changes:

  • Embed System.Diagnostics.FileVersionInfo.TestAssembly output into the test assembly as an EmbeddedResource.
  • Update tests to write the embedded assembly bytes to a temp file and validate FileVersionInfo against that path (including Unix symlink tests).
  • Remove the Apple Mono trimming descriptor file and related csproj wiring.
Show a summary per file
FileDescription
src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csprojSwitches the test-assembly project reference to produce an embedded resource instead of content/project-reference variants.
src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.csAdds helper to extract embedded test assembly to a temp file; updates the custom-assembly test to use it.
src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.Unix.csUpdates symlink tests to use the extracted temp-file copy of the embedded test assembly.
src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/ILLink.Descriptors.xmlRemoves the Apple Mono trimming descriptor that rooted the test assembly.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

@MichalStrehovskyMichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much cleaner!

@kotlarmilos

Copy link
Copy Markdown
Member

/ba-g unrelated extra-platforms failures, no FileNotFoundException or missing assemblies

@kotlarmilos
kotlarmilos merged commit 926a62c into mainJul 10, 2026
109 of 129 checks passed
@kotlarmilos
kotlarmilos deleted the ci-fix/130253-fileversioninfo-nativeaot-testasset-2f516b5b88683d2d branch July 10, 2026 08:52
@dotnet-milestone-botdotnet-milestone-botBot added this to the 11.0-preview7 milestone Jul 11, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
… on Apple NativeAOT (refs #130253) (#130328)
Workflow artifact: ci-fix
Artifact kind: help
Linked KBE: #130253
> [!IMPORTANT]
> **Help-wanted / needs-review draft.** This is a best-effort candidate
fix that I could **not** build-validate in the agent environment (no
Apple NativeAOT cross-build is available here). It is a genuine,
**non-muting** change — it does not disable, skip, or `[ActiveIssue]`
the test. Please validate on the Apple NativeAOT library-test legs
before merging.
## Root cause
On the Apple **NativeAOT** library-test legs (`iossimulator` /
`maccatalyst` `AllSubsets_NativeAOT`, e.g. build
[1494308](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1494308)),
`System.Diagnostics.Tests.FileVersionInfoTest.FileVersionInfo_CustomManagedAssembly`
fails with:
```
System.IO.FileNotFoundException : .../System.Diagnostics.FileVersionInfo.Tests.app/System.Diagnostics.FileVersionInfo.TestAssembly.dll
```
The test opens its companion assembly **by file path** to read PE
version metadata — it never loads or executes it
(`FileVersionInfoTest.cs:25`):
```csharp
VerifyVersionInfo(Path.Combine(Directory.GetCurrentDirectory(), TestAssemblyFileName), ...);
// TestAssemblyFileName = "System.Diagnostics.FileVersionInfo.TestAssembly.dll"
```
In the test `.csproj`, for Apple mobile the TestAssembly was included as
a **plain `<ProjectReference>`**. Under NativeAOT that assembly is
compiled into the native image, so **no loose `.dll` is deployed** next
to the app and `Directory.GetCurrentDirectory()/...TestAssembly.dll`
does not exist → `FileNotFoundException`. Under Apple **Mono** the
managed assembly is still deployed as a file, which is why the test
passes there.
The existing `[ActiveIssue(".../124344", IsAppleMobile && IsCoreCLR)]`
on this test does **not** apply here: `PlatformDetection.IsCoreCLR =>
IsNotMonoRuntime && IsNotNativeAot` is `false` under NativeAOT, so the
test genuinely runs (and fails) on the NativeAOT leg.
These NativeAOT library tests on Apple mobile were newly enabled by
#125437.
## Candidate change
Deploy the TestAssembly as a **Content** data file on the Apple
NativeAOT leg (exactly as already done for desktop), while keeping the
plain project reference for Apple **Mono**, where the
[#46856](#46856) vfs-mapping
workaround still applies:
- `TargetsAppleMobile && UseNativeAotRuntime` → Content copy (**new**).
- `TargetsAppleMobile && !UseNativeAotRuntime` (Mono) → plain reference
(unchanged).
- Browser and desktop → unchanged.
Only the Apple-NativeAOT branch changes; the MSBuild conditions leave
Mono Apple, browser, and desktop provably untouched, and never select
both `<ProjectReference>` items at once.
## What is unverified (why this is a draft)
- I could not run an Apple NativeAOT build here, so I have **not**
confirmed the Content `.dll` actually lands at
`Directory.GetCurrentDirectory()` inside the NativeAOT `.app` bundle,
nor that the AppleAppBuilder NativeAOT library-mode path packages
Content identically to Mono.
- Reasoning it should work: sibling Content files in this project
(`NativeLibrary.dll`, `NativeConsoleApp.exe`) are already deployed and
found on Apple, and under NativeAOT there is no managed-assembly vfs
mapping for #46856 to collide with — but this needs a CI run to confirm.
## Validation
- Build-validated: **No** — Apple NativeAOT cross-build is not available
in the agent environment.
- Requested: run `System.Diagnostics.FileVersionInfo.Tests` on the
`iossimulator` / `maccatalyst` `AllSubsets_NativeAOT` legs and confirm
`FileVersionInfo_CustomManagedAssembly` passes with no `identical vfs
mappings` packaging error.
## Suggested reviewers / area contacts
These tests were enabled on Apple NativeAOT by #125437 —
`@kotlarmilos`, could you (or the mobile/NativeAOT folks) confirm the
Content asset is bundled at the app's working directory under NativeAOT
library mode? Area owners: `@dotnet/area-system-diagnostics`.
> [!NOTE]
> This PR was generated by an AI/Copilot agent (`ci-failure-fix`) as a
best-effort, non-muting candidate fix. Please review carefully before
merging.
> [!NOTE]
> <details>
> <summary>🔒 Integrity filter blocked 17 items</summary>
>
> The following items were blocked because they don't meet the GitHub
integrity level.
>
> - [#128501](#128501)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#104998](#104998)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#104750](#104750)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#97491](#97491)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#76276](#76276)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#78999](#78999)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#76417](#76417)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#69571](#69571)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#62435](#62435)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#61444](#61444)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#35376](#35376)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#193](#193)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#34218](#34218)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#38914](#38914)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - [#44747](#44747)
`search_pull_requests`: has lower integrity than agent requires. The
agent cannot read data with integrity below "approved".
> - #130125 `issue_read`: has lower integrity than agent
requires. The agent cannot read data with integrity below "approved".
> - ... and 1 more item
>
> To allow these resources, lower `min-integrity` in your GitHub
frontmatter:
>
> ```yaml
> tools:
> github:
> min-integrity: approved # merged | approved | unapproved | none
> ```
>
> </details>
> Generated by [CI Outer-Loop Failure
Fixer](https://github.com/dotnet/runtime/actions/runs/28910596516/agentic_workflow)
· ● 9.3M ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fruntime+%22gh-aw-workflow-id%3A+ci-failure-fix%22&type=pullrequests)
<!-- gh-aw-agentic-workflow: CI Outer-Loop Failure Fixer, engine:
copilot, version: 1.0.40, model: claude-opus-4.8, id: 28910596516,
workflow_id: ci-failure-fix, run:
https://github.com/dotnet/runtime/actions/runs/28910596516 -->
<!-- gh-aw-workflow-id: ci-failure-fix -->
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Aug 11, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

agentic-workflowsarea-NativeAOT-coreclrlinkable-frameworkIssues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@MichalStrehovsky@kotlarmilos