私は非常に奇妙な問題を抱えています。次のように、dll で定義されたインターフェイスがあります。
public interface IKreator2
{
string Name { get; set; }
string Description { get; set; }
INotifyPropertyChanged Settings { get; set; }
InfiniRenderJob Job { get; set; }
UserControl UI { get; set; }
void Init();
//void OnClose();
}
WPF アプリでこの dll にリンクすると、読み込み時にデバッガーがクラッシュします (Internal Error: Unhandled Exception in the debugger::HandleIPCEvent, ID=0x246)。「アンマネージ コードのデバッグ」でアプリをデバッグすると、次のエラーが発生します。
- InfiniRender.Host.exe の 0x76977945 (KernelBase.dll) での初回例外: Microsoft C++ 例外: メモリ位置 0x0029c5b8 での EETypeLoadException。
- InfiniRender.Host.exe の 0x76977945 (KernelBase.dll) での初回例外: Microsoft C++ 例外: [rethrow] at memory location 0x00000000.
- InfiniRender.Host.exe で ype 'System.TypeLoadException' の初回例外が発生しました
- タイプ 'System.TypeLoadException' の未処理の例外が InfiniRender.Host.exe で発生しました追加情報: Nicht abstrakte Nicht-.cctor-Methode in einer Schnittstelle.
現時点では、何が起こっているのかまったくわかりません。インターフェースの実装すらなく、それを使用するクラスはありません。メソッド「Init」をコメントアウトすると、すべてが期待どおりに機能します。何か案は??
[編集] これは、インターフェイスの init メソッドの MSIL です。
.method public hidebysig newslot virtual
instance void Init() cil managed
{
// Code size 96 (0x60)
.maxstack 3
.locals init ([0] class [mscorlib]System.Exception CS$0$0__ex)
IL_0000: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0005: callvirt instance bool [NLog]NLog.Logger::get_IsTraceEnabled()
IL_000a: brfalse.s IL_001b
IL_000c: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0011: ldstr "Entering: InfiniRender.IKreator2.Init()"
IL_0016: call instance void [NLog]NLog.Logger::Trace(string)
.try
{
IL_001b: newobj instance void [mscorlib]System.NotSupportedException::.ctor()
IL_0020: throw
IL_0021: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0026: callvirt instance bool [NLog]NLog.Logger::get_IsTraceEnabled()
IL_002b: brfalse.s IL_003c
IL_002d: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0032: ldstr "Leaving: InfiniRender.IKreator2.Init()"
IL_0037: call instance void [NLog]NLog.Logger::Trace(string)
IL_003c: leave.s IL_005f
} // end .try
catch [mscorlib]System.Exception
{
IL_003e: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0043: callvirt instance bool [NLog]NLog.Logger::get_IsWarnEnabled()
IL_0048: brfalse.s IL_005d
IL_004a: stloc.0
IL_004b: ldsfld class [NLog]NLog.Logger '<>z__LoggingImplementationDetails'::l14
IL_0050: ldstr "An exception occurred:\n{0}"
IL_0055: ldloc.0
IL_0056: call instance void [NLog]NLog.Logger::Warn(string,
object)
IL_005b: rethrow
IL_005d: leave.s IL_005f
} // end handler
IL_005f: ret
} // end of method IKreator2::Init
NLogのせいだと私には思えますか?今日までNLogに問題はありませんでした...