-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Under what conditions can TypeBuilder.CreateType()
return null
#68840
Comments
TL;DR: There is no situation when The current source is at runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs Line 1853 in 1a296c0
So based on that, I think the design of
Alternatively, refactor the |
Wow @Jehoel that was incredibly in depth - my mind boggles at how you'd know all that, thank you! EDIT |
BTW I also have an open issue on SO if you copy-paste that into an answer I'll close that. Thanks once more for your help. |
Nah, I'm just on the spectrum |
@Jehoel is right, we should separate the public API from internal nullable API and make public API non nullable, moving to runtime repo for that |
I'd be interested in making the above changes @Jehoel outlined. In terms of testing, would that be a new |
Thanks @JosieBigler, assigning to you. If it is covered well with current tests then no need to add new tests, just need to fix the current test behavior, could not say for sure as I did not check the existing tests. you would see test coverage after fixing the issue and running the tests |
There is no situation when TypeBuilder.CreateType will return null when being called by user-code. issue dotnet#68840
* Make TypeBuilder.CreateType return non nullable There is no situation when TypeBuilder.CreateType will return null when being called by user-code. issue #68840 * Update tests for null check after module.CreateGlobalFunctions() * Check not null for additional CreateType Unit Tests * Remove ! from DispatchProxyGenerator CreateType() * Update Ref for non-null CreateType * Change CreateTypeInfo to return non-null. * Refactored CreateTypeInfo().AsType() to be CreateType() * Annotate failing Mono Assert.Null
Issue description
Under what conditions can
TypeBuilder.CreateType()
return null?Target framework
Details
The
TypeBuilder.CreateType()
method is defined as nullable:Under what conditions can it return null? The docs do not say.
Please document this method signature.
The text was updated successfully, but these errors were encountered: