Debugging Woes...

Posts   
 
    
ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 27-Apr-2006 02:02:47   

Could someone tell me what the proper steps are for debugging an LPT Template?

I am doing the following (as per the documentation): 1) Created a Task in my .config file with debugBuild = "true" 2) Add <[ System.Diagnostics ]> to the top of my .LPT file 3) Select "Default Tasks - Compile and Run..." Set the following options: failWhenExistant = false templateID = Dvx_TestCreateMinimal debugBuild = True DestinationFolder = UnitTests\Support emitType = generic

4) I then select "Run Task"

I get the following results: 1) It never starts the debugger, ever 2) If I select "Generate" instead of "run single task" it will start the debugger, but when it does, it just loads "TemplateStudio.exe" and then tells me there is no code, I can go to the dir and see the .DLL and .PDB files, so I know the debug code is there...but something isn't right. 3) This is the most annoying result: SOMETHING locks the .DLL file that it built (no matter what) so that when I try to rebuild again, I get the very annoying: Error BC31019, at line: 0, pos: 0: Unable to write to output file 'D:\Temp\LGP\DvxUnitTests\UnitTests\Support\LptTemplateAssembly.dll': The process cannot access the file because it is being used by another process.

That's helpful...and if I check ProcessExplorer, guess who has it locked...TemplateStudio.exe! So it locks it's own file and then can't right to it...Argh!

So...can someone tell me how to debug my templates? The docs aren't bad, but they pretty much tell you that the easiest way to figure things out is to debug your template..which I am willing to do...but so far all I have done is waste my entire afternoon beating my head against a brick wall since the debugger never attaches and functions...ever.

Thanks,

Andrew.

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 27-Apr-2006 08:47:11   

The docs at LLBLGen Pro SDK documentation "Template Sets -> Lpt templates engine (.lpt templates)" "Debugging" Paragraph suggests the following:

At the spot where you want to break the execution and you want to step into the debugger, add the following statement (depending on the language you're using for the template logic: VB.NET or C#): <% // For C# Debugger.Break(); %> <% ' For VB.NET Debugger.Break() %>

ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 27-Apr-2006 17:54:55   

Walaa wrote:

The docs at LLBLGen Pro SDK documentation "Template Sets -> Lpt templates engine (.lpt templates)" "Debugging" Paragraph suggests the following:

At the spot where you want to break the execution and you want to step into the debugger, add the following statement (depending on the language you're using for the template logic: VB.NET or C#): <% // For C# Debugger.Break(); %> <% ' For VB.NET Debugger.Break() %>

Yes, I missed that in my description of what I am doing, but I am doing that.

On a positive note, I DID figure out how to get it to "step into" the code. For those that haven't figure it out yet (the boat I was in), once the VS IDE opens up, click the "Step" button (or F10) and it will step you from where it says it doesn't have any src and step you into the code. My assumption is that prior to clicking that "step" the "code" doesn't exist yet so isn't displayed, but as soon as you click the "step" that the "runner" executes the ScriptCode() block so you can actually see the code.

One issue that is still outstanding is it very frustratingly locking the DLL files so that I get at most ONE debug PER open/close of TemplateStudio...there has to be something that I am missing because I can't imagine that is by design.

Thanks,

Andrew.

ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 27-Apr-2006 18:08:45   

Here is some additional follow-up data.

I tried creating multiple "subdirs" below my test dir (eg. Support1, Support2, Suppor3) so I could select a different dir each execution (since the Suppor1 dir DLL files becomes locked as soon as I run it once). This way, at least I could run the debugger 3-4x per execution...problem is, it seems to ignore the DLL in the folder, or at least the PDB file there since the code that it seems to reference is ALWAYS the original code (in Support1)...of course, this is very confusing since the code it displays looks one way, but when it executes, it is executing totally different code.

So, my attempt at a workaround failed...

Am I debugging my Templates incorrectly? Does anyone else write LPT templates? If so, how are you writing them? How are you debugging them? Does anyone else have this issue? (Or am I just "special" sunglasses )