I recently inherited some code that I can't get to build yet. Here's the offending line:
Monitor.Enter(this.foo, ref lockTaken);
According to Visual Studios there is only one definition and it takes a single argument but according to MSDN the two argument version should exist. Any idea how to resolve this?
Thanks.
That overload was introduced in .NET 4. So as you were targeting .NET 2.0, it wasn't present.
When in doubt, check the "Version information" section at the bottom of the documentation.
Admittedly I'd normally be at least slightly nervous about manual calls to Monitor.Enter
/Exit
anyway - in 99% of cases, using lock
is a better idea.
See more on this question at Stackoverflow