C# Visual Studio Debugger UI behavior with lock

前端 未结 3 1938
南笙
南笙 2021-01-22 00:28

I have a block of code in a lock:

lock (obj)
{
  //...
}

I also have a property that locks on that same object. Simple enough scenario. My ques

3条回答
  •  长发绾君心
    2021-01-22 01:04

    Yes, the debugger executes watch expressions on a separate worker thread that's running inside the process. Which will hit the lock in your property getter and block. The debugger puts up with that for 5 seconds, then declares the watch expression unusable and displays "Function evaluation timed out".

    The debugger then gets grumpy, not much it can do with that blocked thread, you'll commonly see "Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation." Which is good advice.

提交回复
热议问题