I have a WPF application that behaves strangely seemingly at random. After running for a while, the UI stops rendering. It is simply not updated, the last view that was updated keeps showing. Mouse-over operations does not trigger markings of checkboxes and other items as it normally does. If I minimize the application and restore it again, the whole window goes black. It is NOT the issue of the UI thread being occupied, the application is still responsive. For example, if I right click the mouse, context menus are appearing and I can select menu items from it as usual. If the item brings up a dialog, the dialog appears and is behaving normally, but the underlying UI is still not rendering. All buttons in the UI are clickable even though they are not visible after the UI going black. Tooltips are popping up when hovering over items with tooltips attached.
This happens quite often when leaving the computer with the application running for a period of time.
Anybody seen this behavior before? Any ideas of what can be causing it? How can I debug this? I have no clue where to even begin.
EDIT: I have run Ants Performance Profiler when the UI freezes, the "% Processor Time" is close to - and sometimes above - 100%.
EDIT: It turned out that this happened every time I went to Windows lock screen and back again. I don't know why this happened, but it had to do with a custom dependency property which was implemented to make p/invoke calls to SetWindowLong, GetWindowLong and SetWindowPos. The dependency property is working as expected, except when going back from the Windows lock screen. Not using it was the "solution" to the problem.