Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting debugger context in C# interactive

C# Interactive seems a lot more powerful than the Immediate Window (at least it handles lambda expressions that are often used in LINQ - see Visual Studio debugging "quick watch" tool and lambda expressions), but it looks like it can't be used as a replacement as it doesn't know about the debugger context. Is there a way to have access to the debugger context?

I've seen Getting debugger context in F# interactive and it might require the same things, but maybe there are new/different things available.

http://extendedimmediatewin.codeplex.com/ could be useful but looks quite dead, although someone said on Oct 18 2011 that he was planning to port it to VB.Net ( http://extendedimmediatewin.codeplex.com/discussions/75589 ).

like image 444
user276648 Avatar asked Oct 26 '11 02:10

user276648


People also ask

How do I show local variables in debugging?

Locals While debugging you can enable 'Locals' which will show you all variables in the current stack frame. Go to menu Debug->Windows->Locals to make it appear. Watch Although it is a little manually you also can use 'Watch' you can drag and drop any variable to this window or right click then add to watch.

How can I see the variable value while debugging in Visual Studio?

When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.

How do I get local debugger in Visual Studio?

On the host computer, in Visual Studio, on the Tools menu, choose Attach to Process. For Transport, choose Windows User Mode Debugger. To the right of the Qualifier box, click the Browse button. Click the Add button.


1 Answers

Not a complete solution, but in VS2015, after you've run Initialize Interactive with Project, you can use Debug > Attach to Process to connect to the InteractiveHost.exe process.

You can then debug functions from your project. You won't be able to debug one-off functions in the Interactive window, though, as Kevin explained.

As as side note, https://stackoverflow.com/a/40650343/467110 points out that you may have to have a C# Interactive window open before you open your solution in order to successfully Initialize Interactive with Project

like image 158
J Bryan Price Avatar answered Sep 30 '22 03:09

J Bryan Price