.DLL ファイルを動的にロードしてそのメソッドの 1 つを実行しようとしています (実際にはメソッドは 1 つしかありません..) が、Activator.CreateInstance メソッドは「抽象クラスを作成できません」という例外をドロップします。これは私のコードです:
Assembly assembly = Assembly.Load(DLLByteArray);
//Type typeToExecute = assembly.GetType("ClassLibrary1.Class1");
//last line was replaced with the next one to ensure that the name is correct.
Type typeToExecute = assembly.GetTypes()[0];
Object instance = Activator.CreateInstance(typeToExecute);
必要に応じてクラスの減速: " public static unsafe class Class1
"。
.DLL クラス コードの何かがこの種の例外を引き起こす可能性はありますか?