vscode-csharp
vscode-csharp copied to clipboard
Add format specifier to allow all threads to run
Steps to reproduce
- Debug the following program
- Evaluate
Program.Test
Expected behavior
There is some way to evaluate this
Actual behavior
Debugger prints: The function evaluation requires all threads to run.
Program content
using System;
namespace clinew
{
class Program
{
static string Test
{
get
{
System.Diagnostics.Debugger.NotifyOfCrossThreadDependency();
return "Test";
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
I imagine we could implement this either by supporting some sort of format specifier (ex: Program.MyProperty,allthreads
) or, for the watch/variables window, maybe we can add a context menu item.
Has this ever been implemented?
Currently in the Watch it just states "The function evaluation requires all threads to run."
In the Watch window there is a need to be able to evaluate functions that requires all threads to run. In Visual Studio we had the option to click the little "thread" button in the Watch window that would execute these functions.
No, not yet
Is there any update on this? I'm really not getting a wonderful experience while debugging. Wonder if there's workaround for this in the meantime?
Same here. This issue makes debugging difficult for 3rd party types. Is there a way to improve debugging?
@gregg-miskelly Are there any chances that this issue will be fixed in the future? For example, it significantly affects the development of C# Selenium tests on MacOS. Debugging on such a configuration is only possible in JetBrains Rider.
@algot this is certainly something that I hope we get to without waiting forever. The two challenges are:
- The normal problem that the VS debugger team is small, and the number of important issues to deal with exceeds our capacity to work on them.
- For this particular issue, VS Code doesn't have a mechanism to provide an experience similar to Visual Studio or JetBrains Rider. So, implementing something good here requires changes to VS Code and the Debug Adapter Protocol, which makes this much more expensive to implement than one might think.
How helpful would you find it if the C# Extension supported a not-great-but-maybe-unblocks-you experience where you could append something like ,allthreads
(example: SomeObject.SomeProperty,allthreads
) to the evaluation arguments to allow the evaluation to proceed allowing all threads to run?
@gregg-miskelly The suggestion of having a not-perfect but potentially unblocking feature like appending ",allthreads" to evaluation arguments in the C# Extension is appreciated. If this approach can offer a workaround for debugging such code, it would be beneficial to have this option.
I am splitting this issue into two parts, this issue will just track the format specifier, and I opened #6959 to track possible future work to make this experience better.
The next version of the C# extension (which I believe is 2.27) will support this. The format specifier is , run-all-threads
.