Skip to content

Commit

Permalink
Wrapped System.Diagnostics.Debugger.Break() into conditional statements.
Browse files Browse the repository at this point in the history
Calling Debugger.Break() with no debugger attached causes ASP.NET application crash if no debugger is attached.

Wrapped all calls to the calls between #if DEBUG [...] #endif statements.
  • Loading branch information
moonpyk committed Mar 17, 2015
1 parent 1740629 commit 7a882dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ImapClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ public virtual void GetMessages(string start, string end, bool uid, bool uidsonl
var imapHeaders = Utilities.ParseImapHeader(response.Substring(response.IndexOf('(') + 1));
String body = (imapHeaders["BODY[HEADER]"] ?? imapHeaders["BODY[]"]);
if (body == null && !uidsonly) {
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif

RaiseWarning(null, "Expected BODY[] in stream, but received \"" + response + "\"");
break;
}
Expand All @@ -470,14 +473,18 @@ public virtual void GetMessages(string start, string end, bool uid, bool uidsonl
response = GetResponse();
if (response == null)
{
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
RaiseWarning(null, "Expected \")\" in stream, but received nothing");
break;
}
}
var n = response.Trim().LastOrDefault();
if (n != ')') {
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
RaiseWarning(null, "Expected \")\" in stream, but received \"" + response + "\"");
}
}
Expand Down
2 changes: 2 additions & 0 deletions Pop3Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public virtual MailMessage GetMessage(string uid, bool headersOnly = false) {
}

if (last != ".") {
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
RaiseWarning(msg, "Expected \".\" in stream, but received \"" + last + "\"");
}

Expand Down

0 comments on commit 7a882dc

Please sign in to comment.