Skip to content

Handle unresolved TypeMap attribute types in Crossgen2 - #133440

Merged
jtschuster merged 1 commit into
dotnet:mainfrom
jtschuster:fix-typemap-crossgen2-fallback
Sep 9, 2026
Merged

jtschuster merged 1 commit into
dotnet:mainfrom
jtschuster:fix-typemap-crossgen2-fallback

Conversation

@jtschuster

@jtschuster jtschuster commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Decode TypeMap attribute values within the existing TypeSystemException try/catch so unresolved serialized type names use runtime fallback instead of terminating Crossgen2.

I must have been using stale bits for #133038 locally and the TypeMap test failures didn't show up in the AzDO Tests tab because the crossgen build failed before the test could run.

Decode TypeMap attribute values within the existing TypeSystemException handler so unresolved serialized type names use runtime fallback instead of terminating Crossgen2.

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

Copilot-Session: 3c9b80dd-d0ce-4a6a-93a8-82c2aaf744f6
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI 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.

🟢 Approval recommended

The change is narrowly scoped, aligns with the existing exception/fallback design in CreateFromAssembly, and avoids altering behavior outside the intended failure-handling path.

Pull request overview

This PR adjusts TypeMapMetadata.CreateFromAssembly so decoding TypeMap* custom attribute values happens inside the existing TypeSystemException try/catch, allowing Crossgen2 to record the failure and fall back to runtime TypeMap attribute processing instead of terminating.

Changes:

  • Moved attr.DecodeValue(new TypeMapCustomAttributeTypeProvider(...)) into the try block that already catches TypeSystemException, so unresolved serialized type names are handled by the fallback path.
File summaries
File Description
src/coreclr/tools/Common/Compiler/TypeMapMetadata.cs Moves TypeMap attribute decoding under the existing TypeSystemException handler so unresolved serialized names trigger the existing fallback behavior rather than crashing.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

@jtschuster

Copy link
Copy Markdown
Member Author

/azp run runtime-coreclr crossgen2

@azure-pipelines

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

@jtschuster

Copy link
Copy Markdown
Member Author

/ba-g Unrelated GC test failure on Wasm.

@jtschuster
jtschuster merged commit 62380aa into dotnet:main Sep 9, 2026
145 of 149 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Sep 9, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 6b01239a Deployed Sep 8, 2026 by jtschuster via conclusion #8006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants