Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the behavior of System.Diagnostics.Debug.Assert() in a Release build?

Tags:

c#

assert

I want to detect and report bugs in specific cases, using the same behavior as Debug.Assert(), but in a Release build. How can I do that?

like image 816
Jay Bazuzi Avatar asked Jan 11 '23 10:01

Jay Bazuzi


1 Answers

You should be able to use Trace.Assert().

From MSDN:

Use the Trace.Assert method if you want to do assertions in release builds. The Debug.Assert method works only in debug builds.

like image 187
Grant Winney Avatar answered Feb 03 '23 15:02

Grant Winney