Unhandled Exceptions outside of VS



Some of us on the .net framework were working on an issue that I've
encountered. It seems that in this code, the catch will not catch the
exception outside of Visual Studio. If run straight from the exe, it'll
generate an unhandled exception.

With some more testing, I've noticed this also happens with Application.Run.

Any Ideas?

Thanks!

using System;
using System.Windows.Forms;

public class Test : Form
{
public Test()
{
Load += new EventHandler(LoadEventHandler);
}

private void LoadEventHandler(object sender, EventArgs args)
{
throw new Exception("Hello");
}

static void Main()
{
try
{
new Test().ShowDialog();
}
catch (Exception e)
{
Console.WriteLine ("Caught "+e);
}
}
}

.



Relevant Pages

  • Re: Try...Catch across assemblies
    ... you will get a messagebox showing the error when run from ... The bad news is I don't entirely understand it. ... public class Test: Form ... private void LoadEventHandler ...
    (microsoft.public.dotnet.framework)
  • Re: creating/copying files..
    ... with FileOutputStream and writing no bytes. ... private void makeFile(){ ...
    (comp.lang.java.help)
  • Would anyone translate this C# fragment into VB ?
    ... An unhandled exception of type 'System.Exception' occurred in ... Could any of you guys please 'translate' this C# into VB .NET, ... private void InitializeComponent() ... private void txtText_GotFocus ...
    (microsoft.public.pocketpc.developer)
  • An unhandled exception of type System.Exception in Microsoft.Win
    ... An unhandled exception of type 'System.Exception' occurred in ... Could any of you guys please 'translate' this C# into VB .NET, ... private void InitializeComponent() ... private void txtText_GotFocus ...
    (microsoft.public.pocketpc.developer)
  • Re: Can’t copy to clipboard
    ... > at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy) ... Dennis ... private void btnCopyAddress_Click ...
    (microsoft.public.dotnet.framework)