I am attempting to debug a preprocessed T4 template and I am not able to step into the class created by running the preprocessed template. I am able to create an instance of the class but as soon as I try to step into while debugging, a new window pops up that says
No source available. There is no source code available for the current location.
My understanding was that preprocessed templates could be debugged just like a normal c# class, is this not correct? Is there anything in particular that you need to do to be able to step into the class defined by a preprocessed template?
Here is a very simple template and the calling code that I am experience the problem with:
TestPreprocessedTemplate.tt:
<#@ template language="C#" debug="true" #>
Hello <# Write("World"); #>
Test Code:
var template = new TestPreprocessedTemplate();
string test = template.TransformText();
Edit - Added the debug="true" statement per the suggestion below, still have same problem.
Update - I also posted this question on the MSDN forums and received response from a MS employee that indicated yes what I described above should indeed work. Anyone else ever run into this problem?
Update - With some help from the MSDN forums, it looks like the problem is with the #line directives that get added to the generated c# class. Commenting them out allows me to step through the code as expected. Is there any way to prevent these directives from being added to the generated class? With an ASP.NET page you can add the LinePragmas="false" parameter but that does not appear to have any effect on a T4 template. Any ideas?