Skip to content

Gate exception field serialization behind langversion 11#19746

Open
T-Gro wants to merge 4 commits into
mainfrom
feature/exception-serde-langversion
Open

Gate exception field serialization behind langversion 11#19746
T-Gro wants to merge 4 commits into
mainfrom
feature/exception-serde-langversion

Conversation

@T-Gro
Copy link
Copy Markdown
Member

@T-Gro T-Gro commented May 15, 2026

Gates the GetObjectData + field-restoring ctor from #19342 behind LanguageFeature.ExceptionFieldSerializationSupport (F# 11).

With langversion ≤10 (current default), exception codegen is unchanged from pre-#19342 behavior.

@T-Gro T-Gro requested a review from a team as a code owner May 15, 2026 12:26
@T-Gro T-Gro requested a review from abonie May 15, 2026 12:26
@T-Gro T-Gro added AI-Auto-Resolve-Conflicts Opt-in: LabelOps merges main into this PR and resolves conflicts every 3h AI-Auto-Resolve-CI Opt-in: LabelOps triages CI failures on this PR every 3h labels May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

❗ Release notes required

@T-Gro,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

You can open this PR in browser to add release notes: open in github.dev

Change path Release notes path Description
LanguageFeatures.fsi docs/release-notes/.Language/preview.md No release notes found or release notes format is not correct

✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

…FieldSerializationSupport (F# 11)

The GetObjectData override and field-restoring deserialization constructor
for exception types are now gated behind langversion 11. With langversion
<=10 (the current default), exceptions emit only the base-call ctor
(status quo ante PR #19342).

- Add LanguageFeature.ExceptionFieldSerializationSupport, mapped to F# 11.0
- Gate shouldRestoreFields and GetObjectData emission on the feature
- Update tests to use withLangVersion "11"
- Update all IL baselines (SerializableAttribute, Nullness) to reflect
  the default-langversion output (no field serde IL)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@T-Gro T-Gro force-pushed the feature/exception-serde-langversion branch from 16c595f to 733c88b Compare May 15, 2026 12:27
@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label May 15, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: 4ee810c

Generated by LabelOps — PR Maintenance

@github-actions

This comment has been minimized.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: 1a04573

Generated by LabelOps — PR Maintenance

@github-actions

This comment has been minimized.

@github-actions github-actions Bot mentioned this pull request May 16, 2026
The net472 baseline was incorrectly updated to use [runtime] prefixed
NullableContextAttribute and NullableAttribute references. On net472,
these attributes are embedded in the assembly (not from runtime BCL),
so they must not have the [runtime] prefix. Also restore the embedded
attribute class definitions at the end of the file.

The serialization changes (removing field-restoring ctor and GetObjectData)
are correctly kept, as they match the default langversion behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: f1a9d69

Generated by LabelOps — PR Maintenance

@github-actions
Copy link
Copy Markdown
Contributor

🤖 LabelOps — CI Fix.

The EmittedIL.NullnessMetadata.Nullable attr for exception types test was failing on WindowsNoRealsig_testDesktop and WindowsCompressedMetadata_Desktop Batch2 (net472).

Root cause: The ExceptionType.fs.il.net472.bsl baseline was incorrectly updated to use [runtime]-prefixed NullableContextAttribute and NullableAttribute references. On net472, these attributes are embedded in the assembly (not referenced from the BCL), so they must not have the [runtime] prefix. The embedded attribute class definitions at the end of the file were also incorrectly removed.

Fixed the baseline to keep the non-prefixed attribute references and embedded class definitions, while preserving the correct serialization changes (simplified ctor, no GetObjectData) for default langversion.

Generated by LabelOps — PR Maintenance · ● 103.1M ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Auto-Resolve-CI Opt-in: LabelOps triages CI failures on this PR every 3h AI-Auto-Resolve-Conflicts Opt-in: LabelOps merges main into this PR and resolves conflicts every 3h AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant