AppDomainを作成し、Event UnhandledExceptionを購読します
AppDomain sandbox1 = AppDomain.CreateDomain("SandBox1");
sandbox1.UnhandledException +=
new UnhandledExceptionEventHandler(sandbox1_UnhandledException);
私のコードが UnhandledException サブスクリプションをステップ実行すると、「Type 'MainUI.MainWindowViewModel' in assembly 'MainUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.」というエラーが表示されます。
編集: だから私は MainWindowViewModel クラスに Serializable を配置しましたが、それでもうまくいきました。アプリケーションを実行すると、同じエラーが発生します。. 助けてください。ありがとうございました
[SecurityPermission(SecurityAction.Demand,
Flags = SecurityPermissionFlag.AllFlags)]
public class MainWindowViewModel : ViewModelBase
{......}
編集
public MainWindowViewModel()
{
AppDomain current = AppDomain.CurrentDomain;
current.UnhandledException +=
new UnhandledExceptionEventHandler(current_UnhandledException);
}
ここでの私の質問は、appdomain の子が 2 つある場合、この例外がどの子からのものかをどのように知ることができますか?