1

I have an internal consistency check in my program that verifies whether two runs of the same code, with the same inputs, give identical results. The idea is to detect unaccounted-for inputs, during development. If the check fails, it breaks into the debugger.

This is all fine and dandy until some other action in the debugger - especially Edit and Continue - modifies one run in the middle of execution. I want to detect this and disable the consistency check.

Obviously because the check itself requires the debugger, I can't do something simple like check Debugger.IsAttached.

Andrew Russell
  • 26,924
  • 7
  • 58
  • 104
  • @JoelB That is actually very workable! Especially as the code in question is deliberately not IO-bound. It also detects other debugger tampering, which is nice in my case. Not to mention that the simplicity is a big win. I'm going to try it now... – Andrew Russell Jun 02 '16 at 03:22
  • @JoelB That works pretty well. If you want to turn it into an answer, I will accept it. – Andrew Russell Jun 02 '16 at 07:00
  • Consider it done. :P – Joel B Jun 02 '16 at 18:20

1 Answers1

1

The only thing I can think of is to use some sort of timing (which seems like a terrible idea). If the time it takes to complete a task is several magnitudes higher than usual, it could be a sign that something is being tampered with. This could result in lots of false positives if things like disk reading/writing are involved. Again, not a great idea, but just a thought

Joel B
  • 801
  • 1
  • 11
  • 30