I’m wondering if I should call if(Debugger.IsAttached) before calling other Debug and Debugger functions?
if(Debugger.IsAttached) { Debugger.Break(); }
vs.
Debugger.Break() // Without checking if Debugger is actually attached
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.
It depends on why you’re calling the
Break()method. According to the documentation:If you don’t want to bother users who aren’t currently debugging, then you should test for attachment first. If you don’t care (or in fact would like the prompt) then don’t check.