DispatcherTimer with Window.Close causing crash
I am writing a C# app that has a main window and a separate login window. I set a DispatcherTimer to open a new login window if the user is idle for a certain period of time.
My app is crashing when i call .Close() on the login window. However, if I remove the DispatcherTimer code it works fine. Is System.Timers.Timer a better choice for this or is there something else I maybe doing wrong?
The strange part is the app doesn't crash and works fine when I run it in Visual Studio, but crashes when i Install it then run it.
Thanks,
Matt
Edit: I just tried installing it on my machine it works fine, but will break when installed on a client machine. Not sure why this would happen.. Maybe 开发者_运维技巧a missing dependency in the setup project? Thanks for your posts guys.
Breaking on all thrown exceptions may allow you to get a call stack for the problem. Go to "Exceptions..." in the Debug menu, and check all of the checkboxes in the "thrown" column.
You will probably want to undo this after you are done testing because it will break even on exceptions handled correctly by the application.
精彩评论