You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the new C# 8 nullability feature in our new projects and while trying to fix some warnings in regard to Activator.CreateInstance, I found out that it returns nullable object.
But after I looked at the code to see in which case does it really return null because I thought it wasn't possible, it turns out it doesn't. See code:
Is this something that can be fixed and the annotation to be correct, or is there an obscure case in other runtimes and implementations where Activator.CreateInstance(Type) could possibly return null?
The text was updated successfully, but these errors were encountered:
I am trying to use the new C# 8 nullability feature in our new projects and while trying to fix some warnings in regard to Activator.CreateInstance, I found out that it returns nullable object.
But after I looked at the code to see in which case does it really return null because I thought it wasn't possible, it turns out it doesn't. See code:
runtime/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs
Lines 82 to 94 in 4f9ae42
Here is the signature of CreateInstanceDefaultCtor:
runtime/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
Line 3980 in 4f9ae42
Is this something that can be fixed and the annotation to be correct, or is there an obscure case in other runtimes and implementations where Activator.CreateInstance(Type) could possibly return null?
The text was updated successfully, but these errors were encountered: