Skip to content

Fix: Using TypeBuilder as generic argument for a parent type throws#99771

Merged
buyaa-n merged 4 commits into
dotnet:mainfrom
buyaa-n:ctor-bug
Mar 18, 2024
Merged

Fix: Using TypeBuilder as generic argument for a parent type throws#99771
buyaa-n merged 4 commits into
dotnet:mainfrom
buyaa-n:ctor-bug

Conversation

@buyaa-n

@buyaa-n buyaa-n commented Mar 14, 2024

Copy link
Copy Markdown
Contributor

Fix a bug: having a parent, that is a generic type that uses a TypeBuilder as generic argument throws on TypeBuidler.CreateType().

Fixes #99505

return GetMemberReferenceHandle(member);
}

private static bool IsConstructedFromNotBakedTypeBuilder(Type type) => type.IsConstructedGenericType &&

@buyaa-n buyaa-n Mar 14, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods initially used for checking if constructed from a not baked TypeBuilder, but now the check for not baked part is removed and its used for all cases no matter if the TypeBuilder was baked or not

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@buyaa-n buyaa-n merged commit a4faf10 into dotnet:main Mar 18, 2024
@buyaa-n buyaa-n deleted the ctor-bug branch March 18, 2024 17:45
@mateuszradny

Copy link
Copy Markdown

Do you publish somewhere information in which version of dotnet/nugets it will be released?

@buyaa-n

buyaa-n commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

It will be included in preview 3, which will be released in mid-April. We do have release notes before release like https://github.com/dotnet/core/tree/main/release-notes/9.0/preview/preview2, but small bug fixes like this will not included.

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using TypeBuilder as a generic type parameter throws NotSupportedException in AssemblyBuilder created by DefinePersistedAssembly

4 participants