Pergunta

I have a windows forms application. It is implemented like a tray icon so when a message arrives it pops up above all other windows. Somehow I have an unhandled exception on a few systems:

Mnclient has encountered a problem and needs to close. We are sorry for the inconvenience.

Report contains next:

EventType : clr20r3 P1 : mnclient.exe P2 : 1.0.0.0 P3 : 51dec1c0 P4 : system P5 : 4.0.0.0 P6 : 50485745 P7 : 57f
P8 : 0 P9 : system.io.filenotfoundexception\

I can't catch this error in my code. What could be the reason?

BTW If I don't close this error-report window, my app continues to work as everything is fine.

So I'm thinking that some system component is trying to close it. But is it possible? And why?

Any other ideas?

Foi útil?

Solução

Create a handler for UnhandledException in your program so that it can help you debug the issue further and handle the exception from wherever it's been thrown (as well as other unhandled exceptions). For example

AppDomain.CurrentDomain.UnhandledException += (s,e) => 
               {
                  Exception ex = (Exception)e.ExceptionObject;
                  Debug.WriteLine(ex.Message);                                          
               };
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top