Is there a way to break the debugger when assertion is false and running the application using Visual Studio debugger. Earlier when I was debugging Windows application I would get an exception and the debugger would break, but now on Smart Device an assertion failed window is showed with stack trace, but I would also like to see variable values etc.

有帮助吗?

解决方案

Stupid me, the solution was simple. When the window pops out, press pause in debugger :)

其他提示

Not sure about VS 2008, but in at least 2010 and later, you can go to Debug/Exceptions (Ctrl-Alt-E). Click the "Add" button, choose "Common Language Runtime Exceptions", and type:

Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException

and hit "OK". It will now appear on the list, make sure you check the checkbox in the "Thrown" column. You will now get a break on any assert failure.

In addition to Vinay's solution, you can start the debugger for a specific process by calling

Debugger.Break

In your case you could do it every time the listener receives a failure message.

It seems that you can attach the Debugger when assertion fails to see other details - see this article: http://blogs.msdn.com/b/davidklinems/archive/2005/08/29/457847.aspx. Its quite dated but perhaps still applicable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top