开发者

DispatcherTimer with Window.Close causing crash

开发者 https://www.devze.com 2023-01-15 06:24 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消