I remember it works long before, but it never works now.
I have defined DEBUG symbol, build in Debug configuration, turn on "break when any Exception throw" option, but the Debug.Assert never assert even the condition is false.
I am using Whidbey Beta2. Is there anything wrong in my settings
Thanks!

How to make Debug.Assert work?
Juan T. Llibre
It cant be the IDE settings since it worked for the other project. So it has to be the project settings. Compare the .csproj/.vbproj file that u have with the other file to see if u can locate any specific setting that has been changed in the project file.
Regards,
Vikram
Anjan Ghose
Hi,
DEBUG MessageBox.Show("DEBUG Defined");Just to check if the build went OK, add the following statement in the Form_load or someplace where it would get executed and see if the MessageBox comes up. This way you will know if the DEBUG constant is available at runtime or not.
Did you copy the EXE from the machine where it worked and try
#if
#endif
Regards,
Vikram
levyuk1
Thanks!
Josue Perez
WM_FYI
thomas woelfer
http://www.die.de/blog
David Spectorman
It just does not work in my large project I mentioned before. I doubt I have changed some settings of the project or VS.NET IDE and caused this problem.
BradA-MSFT
Are you using C# or Visual Basic I tried using C# and it works. Sample I used is below:
Debug
.Assert("st" != "st");You need to check the "Define DEBUG constant and Define TRACE constant in the Build Properties in VS2005.
Regards,
Vikram
Prash_outlawerz
I think I got the same problem:
- Debug.Assert() does not work in a specific c# class library;
- It works correctly in other class libraries and console applications;
- DEBUG is defined and build/run are done in DEBUG mode;
- The Assert message is printed out in the output, for failed asserts in this class library;
- The Assert is ignored and execution continues normally, for failed asserts in this class library;
- No Asser dialog is presented;
- Consistent behaviour - always happens for this class library;
With the help of the link of the previous post, I found that i could not do: new UIPermission(UIPermissionWindow.SafeSubWindows).Demand()
This happened because my assembly had security permissions that would not allow it, so I commented out the following lines, in the AssemblyInfo.cs file:
//[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]//[assembly: PermissionSet(SecurityAction.RequestOptional, Name = "Nothing")]
Hope this helps anyone!
Doublezeta
The same program does not throw assert exception either on the machine of one of my colleague, but works fine for another colleague! So there must be some configuration difference between these machines. However, we have checked all settings and they are all the same. Maybe we omitted something
Thanks!
Andy Leonard
Do a simple test. Build the .Exe on the machine where it is working and then run on ur machine and see if it works Do the other way round, by building on ur machine then running ur colleague's machine.
Then we can know if its a compile time issue or a runtime issue and do further investigation based on that.
Regards,
Vikram