2つのTreeViewの間でドラッグ&ドロップを行うWinFormsアプリケーションがあります。ドラッグアンドドロップ時に例外が飲み込まれる
ある時点で、私は基本的なビジネス実装でアクションを拒否したいので、例外をスローします。私は出力ウィンドウで例外を見ることができますが、問題は私がUIでそれを見ることができず、クラッシュしないということです。
例外はどこに行きましたか?
private TreeView tvLeft;
private TreeView tvRight;
private Dictionary<string, int> dico = new Dictionary<string, int>();
void tvLeft_DragDrop(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent(typeof(TreeNode))) {
var tnSource = (TreeNode) e.Data.GetData(typeof(TreeNode));
var tnDestination = tvLeft.GetNodeAt(tvLeft.PointToClient(new Point(e.X, e.Y)));
// if I drag-drop the same node twice, there sould be an Exception
// since the key is already in the dictionary...
// ...but I get no Exception in the UI, the Application.ThreadException
// or Appomain.CurrentDomain.UnhandledException handlers
dico.Add(tnSource.Name, (new Random()).Next());
}
}
おそらくこのコードにいくつかのコードを共有したいと思うでしょう – AlexCuse