0

My IU thread locks when I start a certain task and updates like once per second. But when I connect performance profiler to study what's up everything is smooth and UI thread is idling 98% of time. I've tried Visual Studio integrated profiler and dotTrace and both yield the same result. How can I analyze UI locks without a profiler?

I hate heisenbugs

Poma
  • 8,174
  • 18
  • 82
  • 144
  • 1
    I'd cut the code into half, binary search the culprit. Add a 10ms-interval timer to your main form and have it update a label. Slowly cut everything and see when there is change. – SimpleVar Aug 28 '16 at 17:48
  • You're running under Visual Studio, right? Just click the [*pause button*](http://stackoverflow.com/a/2474118/23771) and see what it's doing. Simple as that. – Mike Dunlavey Aug 28 '16 at 18:40
  • But then again, they make tools for certain purposes don't they? :) – SimpleVar Aug 29 '16 at 15:43
  • After some experiments I've found that high cpu usage is caused by VS debugger. If I run app outside of VS it runs smoothly. Created a follow-up question http://stackoverflow.com/questions/39304865/attaching-visual-studio-debugger-causes-high-cpu-usage-and-ui-thread-locks – Poma Sep 03 '16 at 08:30

1 Answers1

0

Use Visual Studio; Debug-Windows-Threads. Hit Pause. This will show you all your active threads. Parallel Stacks will show you all the current Stack Traces (in a funky diagram) showing which spawned which.

Using this you will find the last call from each thread/stack, and be able to see what that last call was that led to the freeze.

PhillipH
  • 6,182
  • 1
  • 15
  • 25