Reputation: 2968
I have the following issue with a Debug.Assert ine in a function
public override ReportErrorLevel GenerateResults(bool reformat) {
...
for (int Col = MinResultsCol; Col < MaxResultsCol + 1; Col++) {
try {
ReportColumnTitle ColTitle = ColumnInfo[Col];
#if DEBUG
Debug.Assert(ColTitle.BreakOnGenerate, "...");
#endif
...
} catch ...
}
}
I use this so that I can set a value in the column and then run a report, when the system reaches the column it breaks.
I get occasions when this is not caught, however when I set an unconditional breakpoint before the loop, then run once it is reached, the assertion is then caught (in this case the 15th time through the loop).
(the #if DEBUG is there since ReportColumnTitle.BreakOnGenerate is also in a #if DEBUG section) - I am not asking for a view on whether this is correct:)
This is not consistent other than having set the breakpoint, the assertion then seems to be thrown every time correctly.
Any ideas?
Upvotes: 2
Views: 1405
Reputation: 942348
This behavior matches a problem in the debugger in VS2008 SP1. There was a hotfix released for it. It came back in VS2010, its SP1 fixed it again. Both the hotfix and SP1 are known to be quite stable and take care of debugger problems, I strongly recommend you install it.
Upvotes: 6