Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug and/or trace execution flow in WebMatrix?

Tags:

c#

webmatrix

I am just getting into web development (from a Windows application development background), and WebMatrix seems like a good place to start, due to it's simplicity, and also because it looks like a useful stepping stone towards full ASP.NET MVC development.

However the lack of debugging tools hurts a bit, especially while trying to learn the fundamentals of development in the web environment.

Tracing the flow of execution, and displaying the trace data on the page, seems like a fairly basic capability for an absolute minimum debugging experience, but even that does not seem to be built into WebMatrix (or maybe I just haven't found it yet).

It is easy within a single page to set a trace variable, and then show that variable in the page layout. But how does that help when I need to trace execution across other pages in the flow (e.g. Layout pages, _PageStart pages, etc), and even within my C# classes used during the page building process.

Is there a tracing capability within WebMatrix that I have not yet found? Or alternatively, is there a way to implement a tracing facility that will work throughout the application, and not just in a single page? Even a third party product ($) would be better than nothing.

like image 463
Neville Cook Avatar asked Feb 25 '11 02:02

Neville Cook


1 Answers

Part of WebMatrix's simplicity (and for some, it's appeal) is the lack of bloat such as debuggers and tracing tools! Having said that, I wouldn't bet against a debugger appearing in a future release (along with Intellisense).

Within WebMatrix we have basic 'print variables to the page' cababilities with the ServerInfo and ObjectInfo objects which help with dumping raw info to the frontend. A quick tutorial for using these objects can be found on the asp.net site: Introduction to Debugging.

If you want to go deeper with actual IDE level debugging and tracing, then I suggest you use Visual Studio (any version will work fine, including the free Express edition).

Again there is an excellent introduction to doing this on the asp.net site: Program ASP.NET Web Pages in Visual Studio.

The key points are installing Visual Web Developer 2010 Express and ASP.NET MVC3 RTM. This will give you a handy 'Launch Visual Studio' button in WebMatrix too. Don't worry because you are still making Razor Web Pages sites, it just happens to be in Visual Studio.

like image 126
eddiegroves Avatar answered Oct 30 '22 03:10

eddiegroves