I’m using a library which attempts to do Debug.Assert when I do a certion thing, is there anyway to stop it from using Debug.Assert?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you can recompile the library, then Marc is correct; just recompile it without DEBUG defined and all the assertions will disappear.
If you can’t do that, because say you don’t have the source code of the library, then you can have your program clear out the Trace Listeners. That way when the assertion fires, it still fires but it does nothing. (When an assertion fires, it just checks to see what trace listeners are registered, and informs them about the assertion. No listeners means nothing happens.)
In that scenario you might consider replacing the default trace listener with a customer trace listener of your own that does something like logs the assertion to a file. That way you can review the log and see what assertions would have popped up in the “normal” execution of the debug version of the library.