VS Code setup to mimic VS debugging - asp.net-mvc

I am involved in an ASP.NET MVC application that uses React/Redux. Using VS I can bring up the solution set the default project and with F5 debug the application. The default application just so happens to be a web application so in debugging VS starts IISExpress and I can set breakpoints in the C# code.
I would like to setup VS Code to debug the client side code. For example there are a number of React components defined using .tsx. I would like to set a break point in the .tsx code without having to resort to using the Chrome debugging tools and find the corresponding js code. Is this possible? What do I have to do to launch.json (and possibly other steps) to allow debugging this app with VS Code?
Thank you.

I think this is what you need : https://github.com/Microsoft/vscode-chrome-debug
it allows you to add breakpoints to javascript , and then debug directly from chrome without running external debugging tools.

Related

Bolero (F# Blazor) Debugging

Does someone know how to debug a Bolero project? In particular, is it possible (and how) to debug the client project using and IDE (VS or VS code) or directly in the browser (source mappings)?
Currently there is no ability to debug Bolero (Client side) in the browser that I'm aware of. I recommend using a console trace to watch your model and updates: example. Additionally I've been adding heavy logging for my Bolero project, I find that's often easier with functional code anyways.
You may be able to use the Blazor debugging techniques though I suspect the mappings won't translate back to F#.

Why is my app not using scaffolded Identity pages?

I have an app where I wish to focus on some Identity function enhancements, e.g. password generation etc. I have used "Add scaffolded item->Identity", and each Identity page seems complete and fine.
Yet when I put breakpoints e.g. in the ctor of Login.cshtml.cs, they are not hit, as if the compiled Identity pages are still running the show.
What have I missed in scaffolding out the pages?
Please consider the followings:
Make sure that VS not switched to Release mode (instead of Debug
mode)
If possible, run your VS as the admin, check it. Maybe you could try
to change the platform target(Any CPU, X86, X64).
To make sure that the symbols are loaded for your app, I think you
would get more information from the Output window, see Specify symbol (.pdb) and source files in the Visual Studio debugger (C#, C++, Visual Basic, F#) and PDB Files: What Every Developer Must Know .
Make sure that it has the same framework version when you use the
attach process, see this.

Breakpoint Debugging AngularDart

I'm using VS Code with AngularDart. I need to see, what values are inside some variables. Usually one can do that, by setting a breakpoint. But the debugger doesn't seem to work for web projects.
What's the best way to analyse the contents of my variables? How can I do that? Is this a feature that is supported in Webstorm?
I'm using 5.0.0 and Dartium doesn't seem to be supported anymore.
When you use Dart Dev Compiler (DDC) you can use chrome devtools as you would debug any other scripts on the page. The DDC provides source maps so that you can debug the Dart code you would expect, even though DDC is really providing JS underneath.

debug ASP.NET MVC system code in Azure Compute Emulator

I'm developing an ASP.NET MVC (still v2) Azure web application. I've run into a problem that seems to require me to step through the MVC code itself. I can do this but also need to be able to inspect the code as I step, so I need to be an unoptimized version (so as to not get the "Cannot obtain value of local or argument ...") message in the debugger.
The standard way of circumventing the optimizations (http://blogs.msdn.com/b/sburke/archive/2008/01/29/how-to-disable-optimizations-when-debugging-reference-source.aspx) doesn't seem applicable to running in the Compute Emulator.
I also tried this by creating a local debug build of the System.Web.Mvc project but my web role hangs when I try to start it in the Compute Emulator.
So ... Any help with either of the following would be much appreciated:
Running an Azure web app in Visual Studio (2010) so that it will ignore code optimizations in system dlls.
OR
Creating a local system debug build so that it can be referenced by an Azure web app being debugged in the Compute Emulator.
If the Azure Compute Emulator is giving you issues you could run your MVC project using IIS Express. Just right click and and Select Debug/Start New Instance.
I was finally able to get unoptimized ASP.NET code while debugging in the compute emulator. The basic approach described on MSDN (http://msdn.microsoft.com/en-us/library/9dd8z24x%28v=vs.100%29.aspx) and elsewhere (http://martin.bz/blog/asp-net-mvc-source-debugging-the-easy-way among others) is to put an .ini file that tells the JIT compiler not to optimize in the same directory as the DLL.
The first challenge was to determine just where that was; it finally dawned on me to watch the logs in the Compute Emulator UI and see where they loaded the DLL (in this case System.Web.Mvc) from.
The second challenge was getting the .ini file there. Windows Explorer didn't work because it uses a different way of viewing assembly caches that doesn't give you direct access to the files. One of the posts I read reminded me that using the Command Prompt might give me that access and it did. The last step was realizing, when the Command Prompt wouldn't permit me to move the .ini file into the assembly directory, that I needed to run Command Prompt as admin.
Once I could view variables while debugging, I pretty quickly realized where my bug was.

Cassini stops responding when debugging stops

When developing WebForms web site, I start my project once, Cassini loads and stays loaded until I kill it. Therefore, when I change something (it recompiles in background), and refresh in browser is all it takes to see the changes.
But with MVC, I have to start debugging every time because Cassini is not responding to requests if debugging is not running.
Is it possible to get the same Cassini behavior in MVC as in WebForms?
It isn't usual for this behaviour, even when developing MVC websites. I am able to make changes to non-compiled stuff (aspx,ascx) etc and it'll take effect immediately on refresh. Changing classes will require you to stop debugging so that you can re-compile, and allow breakpoints to work correctly.
Also, whilst isn't strictly an answer to your question, you should strongly consider moving away from the baked-in Cassini web server used when debugging.
For more information on my general hatred of Cassini, please read this previous question.
If you're unable to either install IIS on your machine (because it might be XP Home or whatever), then you should consider either upgrading to XP Professional (where you are limited to running one website only), or Windows Vista, or Windows 7 RC where you can use IIS7 and all the greatness that it provides.
If you can't do any of those, you should consider trying an alternative, such as Ultidev.
I think I found the solution - the trick is to Run project wihout debugging. There is no item for it in Build menu, but keyboard shortcut works (Ctrl+F5 in Visual Basic keyboard scheme).
Cassini starts and remains responsive regardless of debug mode.

Resources