-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make TypeBuilder.CreateType return non nullable #72180
Conversation
There is no situation when TypeBuilder.CreateType will return null when being called by user-code. issue dotnet#68840
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsThere is no situation when TypeBuilder.CreateType will return null when issue #68840
|
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @dotnet/area-system-reflection-emit Issue DetailsThere is no situation when TypeBuilder.CreateType will return null when issue #68840
|
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderCreateType.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
Outdated
Show resolved
Hide resolved
Should EnumBuilder.CreateType be annotated differently as well? What about CreateTypeInfo? Can we remove the Line 312 in 0c32267
|
…/runtime into create-type-not-null
@stephentoub I've removed the It looks like we can change |
src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderCreateGlobalFunctions.cs
Outdated
Show resolved
Hide resolved
Yes, you can remove the no-unnecessary |
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
Show resolved
Hide resolved
Refactored CreateTypeInfo().AsType() to be CreateType()
} | ||
|
||
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] | ||
internal TypeInfo? CreateTypeInfoImpl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateTypeInfoImpl is identical to CreateTypeImpl. Could you please delete CreateTypeImpl and make CreateTypeInfo to call CreateTypeImpl instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to only have 1 internal method with a signature of internal TypeInfo? CreateTypeInfoImpl()
.
Could you please merge from main to resolve conflict in TypeBuilderAddInterfaceImplementation.cs? |
@@ -239,7 +239,7 @@ public void BakeMethods() | |||
|
|||
if (!_useLRE) | |||
{ | |||
typBaked = _typeBldr!.CreateTypeInfo()!.AsType(); | |||
typBaked = _typeBldr.CreateType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typBaked = _typeBldr.CreateType(); | |
typBaked = _typeBldr!.CreateType(); |
I think this needs to stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added back the ! to _typeBldr
.
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT. Thank you!
@JosieBigler You never thought it would get this complicated when you volunteered... 😄 Seriously though, well done and thanks! |
There is no situation when TypeBuilder.CreateType will return null when
being called by user-code.
Fixes #68840