Uncatcheable exception from MethodInfo.Invoke

前端 未结 4 1815
闹比i
闹比i 2020-12-22 09:08

I have this code which Invokes a MethodInfo:

try
{
     registrator.Method.Invoke(instance, parameters);
}
catch{
    registrator.FailureType = RegistratorFa         


        
4条回答
  •  攒了一身酷
    2020-12-22 09:35

    Have you tried this?

    In Program.cs

    Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
    

    And a try/catch on the Run method:

    try
    {
        Application.Run(new Form1());
    }
        catch (Exception ex)
    {
    }
    

提交回复
热议问题