Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Fix linker crash in generated type analysis - #2827

Merged
agocke merged 3 commits into
dotnet:mainfrom
agocke:fix-crash-on-static-closure
Jun 8, 2022
Merged

agocke merged 3 commits into
dotnet:mainfrom
agocke:fix-crash-on-static-closure

Conversation

@agocke

@agocke agocke commented Jun 8, 2022

Copy link
Copy Markdown
Member

The generated type analysis works by trying to create a type mapping,
where type parameters from generated types (state machine types) are
mapped back to the original method type parameter they were created
from. This isn't possible for the type parameters of "static" closures,
where there is a single closure environment created for multiple lambdas
which don't capture any values.

This change works around the problem by avoiding remapping those type
parameters. They will be left as the original type parameter (and may
leave warnings about generated code).

The generated type analysis works by trying to create a type mapping,
where type parameters from generated types (state machine types) are
mapped back to the original method type parameter they were created
from. This isn't possible for the type parameters of "static" closures,
where there is a single closure environment created for multiple lambdas
which don't capture any values.

This change works around the problem by avoiding remapping those type
parameters. They will be left as the original type parameter (and may
leave warnings about generated code).
@agocke
agocke requested a review from marek-safar as a code owner June 8, 2022 03:20
@agocke
agocke requested review from sbomer and vitek-karas June 8, 2022 03:21
@agocke
agocke merged commit 978b631 into dotnet:main Jun 8, 2022
@agocke
agocke deleted the fix-crash-on-static-closure branch June 8, 2022 16:57
agocke added a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
The generated type analysis works by trying to create a type mapping,
where type parameters from generated types (state machine types) are
mapped back to the original method type parameter they were created
from. This isn't possible for the type parameters of "static" closures,
where there is a single closure environment created for multiple lambdas
which don't capture any values.

This change works around the problem by avoiding remapping those type
parameters. They will be left as the original type parameter (and may
leave warnings about generated code).


Commit migrated from dotnet/linker@978b631
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants