static internal object UnsafeGetUninitializedObject(Type type)
{
#if !NET_NATIVE
if (type.GetTypeInfo().IsValueType)
{
return Activator.CreateInstance(type);
}
const BindingFlags Flags = BindingFlags.Public | BindingFlags.Instance;
bool hasDefaultConstructor = s_typeHasDefaultConstructorMap.GetOrAdd(type, t => t.GetConstructor(Flags, Array.Empty<Type>()) != null);
return hasDefaultConstructor ? Activator.CreateInstance(type) : TryGetUninitializedObjectWithFormatterServices(type) ?? Activator.CreateInstance(type);
#else
return RuntimeAugments.NewObject(type.TypeHandle);
#endif
}