I have the following problem. FindRoot is actually in a third party dll and I do not have control over it. It has to be called via Begin invoke. Sometimes, the FindRoot method throws exception. This causes my whole application to crash. Now how do I prevent my application from crashing even if FindRoot throws exception.
delegate void AddRoot(double number);
public static void FindRoot(double number)
{
throw new Exception();/// sometimes is thrown.
}
static void back_DoWork(object sender, DoWorkEventArgs e)
{
AddRoot root = FindRoot;
root.BeginInvoke(12.0, root.EndInvoke, root);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…