IL2032: Unrecognized value passed to the parameter 'parameter' of 'System.Activator.CreateInstance' method

Cause

The value passed to the assembly or type name of the CreateInstance method cannot be statically analyzed. The trimmer cannot guarantee the availability of the target type.

Example

void TestMethod(string assemblyName, string typeName)
{
    // IL2032 Trim analysis: Unrecognized value passed to the parameter 'typeName' of method 'System.Activator.CreateInstance(string, string)'. It's not possible to guarantee the availability of the target type.
    Activator.CreateInstance("MyAssembly", typeName);

    // IL2032 Trim analysis: Unrecognized value passed to the parameter 'assemblyName' of method 'System.Activator.CreateInstance(string, string)'. It's not possible to guarantee the availability of the target type.
    Activator.CreateInstance(assemblyName, "MyType");
}