Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 hangs on trace point

The Problem:
Whenever I try to break or set a Trace-point in the debugger, our application and visual studio freezes completely. After detaching the debugger the application continues.

This problem is probably related to WPF. We have migrated our WinForm application to WPF. Since then this problem occurs. But I'm not able to find the specific part of the code which causes the problem. I have already rolled back hundreds of commits but without success.

It might also be related to the UI thread. If the breakpoint is set somewhere away from the UI logic the application will not freeze or it will not freeze as often as it does somewhere in the UI Thread.

[Edit:]
I use Windows 7. 64bit with Visual Studio 2010

[Update:]
When Visual studio hangs, and i try to detach before the breakpoint is displayed, the Message "Unable to detach from one or more processes. All outstanding func-evals have not completed". But i have disabled all func evaluation in the debugging options. I think my problem is caused by a func_evaluation which can not complete or which runs into a timeout.

Is there a way to see on which func_evaluation visual studio is hanging?

Example:

class SomeUiViewPresenterExample
{
   private Timer m_Timer;

public void Init()
{
    m_Timer = new Timer();
    m_Timer.Elapsed += ElapsedFoo();
    m_Timer.AutoReset = false;
    m_Timer.Interval = 200;
}

private void ElapsedFoo(object sender, ElapsedEventArgs elapsedEventArgs)
{
    // there is no code inside this method
    // On the next line a trace point with "---> ElapsedFoo called" will freeze the debugger
}

What I have already tried: (without success)

  • enable / disable the host process
  • tried to debug x86 and x64 processes
  • launched visual studio with /SafeMode
  • NGEN update
  • disabled "property evaluation and other implicit function calls" in Debugging options
  • disabled symbol servers
  • disabled symbol loading
  • deleted WPF font cache
  • Marked several UI elements with 'DebuggerDisplay("some text without expression")'

(Ticket Microsoft Connect)

Probably related problem:

Because our application uses .NET Remoting to communicate with another process, my problem my be something similar as here. I have placed all registrations to remoted events in a own Task, but without success.

Debugger Output from debugged visual studio:

I have attached a debugger to visual studio and have observed some exceptions,(80010005)

but I have no idea whether they are relevant for my problem or not:

(18d8.1708): C++ EH exception - code e06d7363 (first chance)
(18d8.1708): C++ EH exception - code e06d7363 (first chance)
..... // snip
(18d8.18dc): **Unknown exception - code 80010005 (first chance)
..... // 20 seconds freeze until breakpoint hit in IDE

(18d8.18dc): Unknown exception - code 80010005 (first chance)
(18d8.18dc): C++ EH exception - code e06d7363 (first chance)
ModLoad: 365f0000 36665000 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\mcee.dll

// after continue execution debugger and debugged process freezes forever

(18d8.18dc): Unknown exception - code 80010005 (first chance)
ModLoad: 00000000`02b90000 00000000`02c1c000 C:\Windows\SysWOW64\UIAutomationCore.dll
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
(18d8.1a8c): CLR exception - code e0434352 (first chance)
like image 399
Manuel Amstutz Avatar asked Feb 07 '13 15:02

Manuel Amstutz


People also ask

What is trace point in Visual Studio?

Abhijit Jana 7 years agoVisual Studio. Trace Point is nothing but a breakpoint with some actions. When Action is added into a breakpoint, Visual Studio would execute them during debugging. You do also have and option to continue the execution without pausing it or pause it.

What is a trace point?

The trace command defines a tracepoint, which is a point in the target program where the debugger will briefly stop, collect some data, and then allow the program to continue.

How do you use Tracepoint?

Set tracepoints in source code You can set tracepoints by specifying an output string under the Action checkbox in the Breakpoint Settings window. To initialize a tracepoint, first click on the gutter to the left of the line number where you want to set the tracepoint.


3 Answers

The more I look at this, the more I suspect it's because you're not using the WPF timer. If you try to use the regular Timer class rather than the WPF Dispatcher timer, you run the risk of trying to update the UI on a non-ui thread - which could potentially be the cause of your problem (Since the DataContext is part of the UI technically).

More info here:

DispatcherTimer vs a regular Timer in WPF app for a task scheduler

like image 108
sircodesalot Avatar answered Oct 05 '22 10:10

sircodesalot


You can use the windebug tool from this below url to better debugging and sort it out the solution

http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

like image 43
Smaug Avatar answered Oct 05 '22 08:10

Smaug


Thanks for your hints. Finally I have installed VS 2012 and the debugger now behaves as normal. It seems there is really a bug / performance issue in the visual studio 2010 debugger.

like image 43
Manuel Amstutz Avatar answered Oct 05 '22 10:10

Manuel Amstutz