hi, have no idea what didn't you understand here:
but i'm sorry anyway. i'll try to explain it again.
in a winforms app, in a form's Load event, add the following line:
throw new Exception();
and run the application. it ran without a problem. this called a silent failure, you can try to add messageboxes before and after, and you'll soon find out that instead of crashing the application, the throw statement just exits from the Load event.
i'm sure there is no need to explain how ugly and dangerous this is.
i was wondering nonetheless in the (probably history) reasons behind this terrifying behavior. i'm sure it's not a design decistion, probably no-choice, or laziness. does anybody knows?
would be glad if anyone can point me to a list of events which may cause seilent failiures two.
thanks.
EDIT: i've been asked to a snippet of my code. honestly, guys, i have no idea how it helps you but, here the thing:
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms;
namespace WindowsFormsApplication1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Form f = new Form();
f.Load += new EventHandler((x, y) => { throw new Exception(); });
Application.Run(f);
}
}
}
p.s. in my blindness i've just noticed that i was voted down 3 times in my last question (link in the start)... if any of you find this question okay (the first one), i would be happy if you help me get back my lost accept rate by voting it up :D
EDIT 2: O_o weired enough it seems it does not happend to everyone..
i use: fw 3.5, winforms, vs 2008, vista x64, new clean project of winforms, with the code mentioned above.