An exception will not be detected if I do not debug the application

There are two DLLs, A and B, in A.DLL there is a form class similar to this:

namespace AAA
public class AForm: Form
{
  ...
  private void btnOK_Click(object sender, EventArgs e)
  {
      DoSomeSth();
  }
}

B.DLL has code like this

try
{
   AForm dlg = new AAA.AForm();
   dlg.ShowDialog();    
}
catch(Exception ex)
{
   MessageBox.Show(ex.Message);
}

There will be an exception in the DoSomeSth function after clicking OK. When I debug code with vs2005, the exception can be caught in B.DLL, but if I started the application directly without debugging, the exception will not be found in B.DLL, what is the reason?

+3
source share
1 answer

This is a known issue . According to KB article:

Windows Forms , NativeWindow.CallBack (). NativeWindow.CallBack, .

, Windows Forms , , NativeWindow.DebuggableCallBack. NativeWindow.DebuggableCallBack, (JIT) .

+3

All Articles