private void Exec_callback(System.IAsyncResult ar) { this.WriteLine("Exec_callback: before cast"); object[] array = (object[])ar.AsyncState; TestThread dlg2 = (TestThread)array[0]; string c = (string)array[1]; try{ this.WriteLine("Exec_callback: before EndInvoke"); dlg2.EndInvoke(ar); this.WriteLine("Exec_callback: after EndInvoke"); }catch (System.Exception e) { //DEBUG: this.WriteLine("caught Error Invoke:" + e.GetType().ToString() + "\n\t" + e.Message); ErrorView view = new ErrorView(); view.AddException(e); view.ShowDialog(); } //--実行権の返上 this.WriteLine("Return"); this.completed = true; }