best way to debug apps

Jan 16, 2015 at 3:22 PM
I am still doing all my debugging with trial and error and reading the event logs. Is there an option that you can actually run and step through the templates, how to set that up, especially now with all the new features as well.

Jan 20, 2015 at 8:11 AM
Hi Armand

The answer is yes and no :).

The first question you usually have to ask yourself is: where does the problem occur. Is it JavaScript, is it Server-Side or is it incorrect stuff (like wrong URLs or JSON). To figure this out, I recommend you read my newest blog about debuging web-api.
This will show you how to corner issues, and how to do the JavaScript / HTTP part of the debugging.

For server side, you can actually attach Visual-Studio debugger to a site to debug Razor and WebAPI. Then you can step-through your code or find errors.
Jan 23, 2015 at 6:37 PM
This can be less than satisfying ...

Over the last few days I was having lots of trouble with a Razor script (in a Razor Host module). I was getting really odd error messages (at least I didn't understand them and they didn't seem pertinent to the code).

It turns out that I was trying to use a static method incorrectly. Nothing in the errors indicated anything like this.

It was only when I gave up and tried using similar code in a c# module that the (wonderful) compiler identified the problem for me. I went from several hours of pain and suffering to solution in a few minutes, mostly thanks to Intellisense (and not much Joesense).

I see this as a real issue going forward. I'd hate to consider debugging a complex application using the tools that seem to be available. Seems like I had better tools when I was writing my code on punch cards. :>(
Jan 27, 2015 at 7:26 AM

Which tools are you using? Because you can use Visual Studio and similar tools and get the full intellisense.
Jan 27, 2015 at 12:57 PM

I guess I need a few pointers relative to debugging using VS (specifically VS2012). Can you provide a few pointers here?

Can I "open" a 2sxc module in VS, and edit code? How do I "attach to process," set breakpoints, etc? A tutorial there would be helpful to me!
Feb 3, 2015 at 2:57 PM
We'll probably blog about this some time but for now the short answer is simple: just open the web from visual studio (the entire web), and press play in VS. That's all you need!
(remember to set the debug in web.config to true, but VS will ask you about this if you forget).