Skip to content

Strip F# metadata during trimmed F# publishing - #20527

Open
T-Gro wants to merge 5 commits into
dotnet:mainfrom
T-Gro:t-gro-metadata-stripping-proof
Open

T-Gro wants to merge 5 commits into
dotnet:mainfrom
T-Gro:t-gro-metadata-stripping-proof

Conversation

@T-Gro

@T-Gro T-Gro commented Sep 11, 2026

Copy link
Copy Markdown
Member

The old target generated XML after MSBuild had collected embedded resources. The file existed in obj, but fsc never received a --resource argument for it. Moving generation earlier introduced duplicate ILLink.Substitutions.xml resources with standalone builds and user descriptors.

This changes who consumes the file: the existing task generates the rules during publish, and ILLink --substitutions file.xml reads them directly. Nothing new is embedded. The compiler, task implementation, FSharp.Core descriptor, and user descriptors are unchanged.

The cache records the opt-out value so changing it reruns trimming instead of reusing an already-stripped output. An unchanged publish still skips compilation and trimming.

Scope: ordinary app/library assemblies published from an F# project with PublishTrimmed. Metadata copied by explicit --staticlink, C#-hosted publishing, and NativeAOT remain unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

✅ No release notes required

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure labels Sep 11, 2026
@github-actions

This comment has been minimized.

perf-bundle and others added 2 commits September 11, 2026 16:24
Remove the compiler XML parser, task changes, diagnostic and added fixture. Reuse GenerateILLinkSubstitutions at PrepareForILLink and pass its output as trimmer substitutions. Preserve standalone compilation and user resources without changing compiler code.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@T-Gro T-Gro changed the title Fix automatic F# metadata stripping during trimming Strip F# metadata during trimmed F# publishing Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Build-Infra, Affects-Compiler-Output, Affects-Test-Tooling
Affects-Build-Infra: MSBuild target changes trimming-time task execution.
Affects-Compiler-Output: Publishing removes metadata from produced assemblies.
Affects-Test-Tooling: Trimming validation script controls test assertions.

Generated by PR Tooling Safety Check · gpt56 996.3K ·

Keep descriptor generation and trimmer arguments together, remove unnecessary XML quote escaping, and explain the separate input needed when the opt-out changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@T-Gro

T-Gro commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

/azp run fsharp-ci

@azure-pipelines

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

@T-Gro
T-Gro requested a review from abonie September 14, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant