views:

108

answers:

1

Using System.TimeSpan in a C# application, with WPF. TimeSpan is an argument in a method call.

SixDOFPosition GetPositionForTimeCount(TimeSpan timeCount)

Using VS 2009, this error is displayed in the debugger when trying to look at the value of timeCount:

Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible

The problem is that as soon as this error appears, objects' properties values cannot be debugged (not limited to TimeSpan instances), the same message is displayed.

MS reports large structures cannot be debugged safely and the debugger display this msg. Any workaround more elegant than wrapping the structure in a class?


I'm using VS Express 2008, the Debug settings are selected automatically when F5 is pressed, I don't have many options to select.

A: 

Is your program being compiled with the "Debug" settings or the "Release" settings? There should be a toolbar that lets you toggle in between. It's possible that with Release settings there is too much optimization going on. By choosing "Debug" you might get a better experience.

Also, make sure that you start the application through the debugger as opposed to first running the program and then attaching the debugger. Starting the application through the debugger will disable even more optimizations and this can help create a better debugging experience.

Eilon