Activator can't create array and string?

Hey!

I know this is probably not an issue with unity, but I can’t see what’s been updated or changed recently. Problem is I used the System.Activator.CreateInstance method to dynamically create classes and it worked fine until yesterday. Now suddenly it can’t create instances of arrays and strings. Do you guys have this issue? Please test this: System.Activator.CreateInstance(typeof(string));. I understand why it would make no sense to have a default string constructor but it used to work.

Thanks!

If you take a look at implementation of static public T CreateInstance<T>() method inside Activator class source you can check out the comment for throwing MissingMethodException there which states that:

Array, Ref, and Pointer types don’t
have default constructors.

And since you are trying to create an object with default constructor here, it is throwing the error.