Skip to content

[release/10.0.4xx] Restore legacy cross-assembly inline metadata - #20267

Open
github-actions[bot] wants to merge 15 commits into
release/10.0.4xxfrom
backport/pr-20260-to-release/10.0.4xx
Open

[release/10.0.4xx] Restore legacy cross-assembly inline metadata#20267
github-actions[bot] wants to merge 15 commits into
release/10.0.4xxfrom
backport/pr-20260-to-release/10.0.4xx

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #20260 to release/10.0.4xx

/cc @T-Gro

Note: Release notes and eng/common files are excluded from this backport. If release notes are needed, they should be added manually to the appropriate version file for this branch.

Customer Impact

Testing

Risk

IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.

T-Gro and others added 14 commits August 16, 2026 14:09
Regression fixture: LegacyInline.dll built with .NET SDK 10.0.105
(F# compiler without ValInline.InlinedDefinition). That compiler used
the pre-InlinedDefinition encoding where ValInline.Always = 0x00 bits.

The current compiler reads 0x00 as InlinedDefinition (ShouldInline=false).
With --optimize-, crossAssemblyOpt() returns false and ShouldInline=false,
so the body is never fetched; the optimizer emits a direct IL call instead
of the inlined form expected for an `inline` function.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the arithmetic-only `increment` fixture with a cross-assembly
inline SRTP function whose compiled (non-inlined) fallback body is the
compiler-generated "Dynamic invocation of Invoke is not supported"
placeholder, matching the shape of the real-world regression (issue
20253, Aether's op_HatEquals). LegacyInline.dll is regenerated from the
updated LegacyInline.fs with the official .NET SDK 10.0.105 F# compiler.

The test now exercises Release/optimized codegen (withOptimize) and
compiles+runs the consumer, asserting no direct call to the placeholder
remains in the imported IL.

Note: exhaustive testing against SDK 10.0.100/10.0.105/10.0.203/10.0.301
shows none of these official compilers actually emit the ambiguous
zero-bit ValInline encoding for this shape (SRTP trait resolution and
witness-passing both resolve the call at the consumer's type-check time,
independent of the ShouldInline metadata bit), so this fixture does not
currently reproduce a failing run against HEAD. It does correctly
validate the cross-assembly SRTP import path and regresses if a future
change reintroduces a direct call to the placeholder body.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Build LegacyInline.dll with the official .NET SDK 3.1.100 F# compiler (10.7.0.0 for F# 4.7), which predates witness metadata and preserves the legacy inline encoding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refactor Issue 20253 test to focus on IL verification, removing runtime
execution that doesn't contribute to the regression contract. The test
now compiles as a library and verifies that the legacy inline metadata
from LegacyInline.dll is properly inlined, preventing the direct call
to LegacyInline.Library::invoke from appearing in the emitted IL.

This change:
- Simplifies Consumer module from EntryPoint program to library function
- Removes runtime execution verification (run | shouldSucceed | verifyOutputContains)
- Retains compile success verification (shouldSucceed)
- Maintains IL regression assertion (verifyILNotPresent [ "LegacyInline.Library::invoke" ])

The IL assertion is the actual regression contract for this issue.

Co-authored-by: Copilot <copilot@example.com>
u_ValData deserialized ValFlags directly from the pickled int64, so
DLLs written by compilers <= 4.7 (pre-witness), which encoded
PseudoVal/Always inline info as all-zero inline bits, were imported as
ValInline.InlinedDefinition after PR #19548 repurposed the same 0x00
bits for that case. Add ValFlags.OfPickledBits, mirroring the
InlinedDefinition -> Always normalization PickledBits already applies
on write, and use it in u_ValData so legacy zero-bit values import as
Always (ShouldInline=true) regardless of which compiler wrote them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compile the Issue 20253 consumer out-of-process via runFscProcess
instead of CompilerAssert.CompileRaw in-process. The in-process path
can mutate shared compiler/import state across tests sharing the same
process, so keep this legacy pre-witness FSharp.Core regression check
at the IL boundary without touching the test host's own state.

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

Copilot-Session: d9bb5fd2-ae26-4369-934d-1bae177a1266
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9bb5fd2-ae26-4369-934d-1bae177a1266
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9bb5fd2-ae26-4369-934d-1bae177a1266
@github-actions
github-actions Bot requested a review from a team as a code owner August 16, 2026 14:09
@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Aug 16, 2026
The Check_Published_Package_Versions FSCore leg restores FSharp.Core at
the version in eng/Versions.props and fails when the restore succeeds,
meaning that version is already on nuget.org. FSharp.Core 10.1.400 has
now been published, so bump FSBuildVersion 400 -> 401 to the next free
servicing version. FCS moves to 43.13.401 (also unpublished).

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

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@T-Gro T-Gro added NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes Servicing-consider labels Aug 17, 2026
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes Servicing-consider

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants