G
Guest
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);
}
}
}
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);
}
}
}