Is it safe just to set CheckForIllegalCrossThreadCalls to false to avoid cross threading errors during debugging?

No, that’s not safe. The Winforms code that checks for threading mistakes is very important, the trouble that causes is extremely hard to diagnose. The biggest problem is that it doesn’t cause consistent failure, your app will misbehave randomly and deadlock or crash only once a month. Or never at all, until you make a minor change. Or only on a particular user’s machine, you’ll blame the user instead of your code.

The only reason the CheckForIllegalCrossThreadCalls property exists in the first place is to keep .NET 2.0 and up compatible with buggy .NET 1.x programs where this threading safety test was not performed. Backward compatibility for bugs ;-P

Leave a Comment