Is there any way to cause Visual Studio 2010 to break while debugging when the argument of Debug.Assert
evaluates to false
?
Example: in my
It seems to work as expected for me in a console application at least: in debug builds, a dialog pops up that allows you to break into the application using the debugger, but in release builds, nothing happens. Admittedly, I just used a simplistic Debug.Assert(false);
, but I don't see why that should make much of a difference. I'm running Visual Studio 2010 SP1 Ultimate.
I'd suggest that you take a close look at your build settings.
Here's the code I used:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Debug.Assert(false);
Console.ReadLine();
}
}
}