Closed Guillermo-Santos closed 7 months ago
ref struct should not be supported: If the type you are trying to instantiate is a ref struct these methods should throw a NotSupportedException (as far as I know, is because ref struct should never be boxed), but since, at the moment, we cannot check if a type is a ref struct (System.Type.IsByRefLike field not plugged) we just process the ref struct and return it as a normal struct or class.
@Guillermo-Santos if it has not already been done could you make a issue for this so we can track it
ref struct should not be supported: If the type you are trying to instantiate is a ref struct these methods should throw a NotSupportedException (as far as I know, is because ref struct should never be boxed), but since, at the moment, we cannot check if a type is a ref struct (System.Type.IsByRefLike field not plugged) we just process the ref struct and return it as a normal struct or class.
@Guillermo-Santos if it has not already been done could you make a issue for this so we can track it
Will do
This PR add the plugs for
System.Activator.CreateInstance<T>()
andSystem.Activator.CreateInstance(Type T, bool, bool)
two methods that are used to create generic types.With
System.Activator.CreateInstance<T>()
the following start to work on cosmos:Limitations
To avoid this, you would need to add a
dummy
variable somewhere (BeforeRun
recommended) to make IL2CPU include the ctor on the compilation.ref struct
should not be supported: If the type you are trying to instantiate is aref struct
these methods should throw aNotSupportedException
(as far as I know, is becauseref struct
should never be boxed), but since, at the moment, we cannot check if a type is aref struct
(System.Type.IsByRefLike
field not plugged) we just process theref struct
and return it as a normal struct or class.