Aracılığıyla paylaş


IL2032: 'System.Activator.CreateInstance' yönteminin 'parameter' parametresine geçirilen tanınmayan değer

Neden

Yöntemin derlemesine veya tür adına CreateInstance geçirilen değer statik olarak çözümlenemez. Düzeltici, hedef türün kullanılabilirliğini garanti edemez.

Örnek

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");
}