Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CodeSmith debugging


May 25, 2021 CodeSmith


Table of contents


Debugging

Writing CodeSmith templates requires debugging as much as writing programs, and CodeSmith supports the use of CLR's Just-in-Time debugger debugger debugger debugger debugs.

To debug a template, first open the debug debug in the CodeTemplate declaration:

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="True" %>

The second step is to set break points: call System.Diagnostics.Debugger.Break ();

System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();

In calling System.Diagnostics.Debugger.Break (); You need to call System.Diagnostics.Debugger.Launch ();

This pauses visual Studio at the specified break point at Generate Output:

CodeSmith debugging

You can also add debug information with .Net's System.Diagnostics.Trace and System.Diagnostics.Debug.