view source code while debugging

Posts   
 
    
sickmat
User
Posts: 13
Joined: 28-Feb-2007
# Posted on: 01-Mar-2007 21:45:54   

Is it possible to view the source code of the lpt template while debugging?

Using the tutorial "Debuggin Lpt templates" within the Template Studio Documentation I was able to get so far as launching VS2005 as the debugger. However I receive a prompt saying that sourcecode is not availabe. I have tried hitting OK and moved on as suggested by the tutorial but I find it extremely difficult to figure out where I am within the code. Choosing "step into" or "continue" does not take me to the breakpoint as far as I know. When using the immediate window and typing "this" I receive this message:

this {test_SD_ListPageAspx} __outputWriter: {System.IO.StreamWriter} _activeObject: {SD.LLBLGen.Pro.ApplicationCore.Entities.EntityDefinition} _executingGenerator: {SD.LLBLGen.Pro.GeneratorCore.Generator} _parameters: Count = Cannot evaluate expression because the code of the current method is optimized.

Also, what is the correct format for "templateAssemblySourceFileFormat"? Is this the missing piece to the puzzle? I was unable to find any example with the forum or docs.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39776
Joined: 17-Aug-2003
# Posted on: 01-Mar-2007 22:10:40   

Did you create a debug build of the .lpt templates or a release build? You need to build a debug build of the lpt templates otherwise there's no .pdb file created of the lpt sourcecode.

Frans Bouma | Lead developer LLBLGen Pro
sickmat
User
Posts: 13
Joined: 28-Feb-2007
# Posted on: 01-Mar-2007 23:06:20   

When generating the code from within Template Studio I selected the "Task queue to execute" tab. I selected the preset I created and following that the task to debug. The task has a templateID of the template that contains the Debugger.Break() statement. Since the preset has "debugBuild" set to false by default for that task I change the parameter value to true.

After that I click "Start generator", eventually the option to debug is presented to me and I select it. The process continues until I am given the option to select a debugger, I choose a new instance of VS2005.

Visual Studio displays the Modules and Disassembly only, I have been notified by VS before that the source code is not available.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39776
Joined: 17-Aug-2003
# Posted on: 02-Mar-2007 12:21:20   

If you then press F5 will you go to the sourcecode?

the first task which refers to .lpt templates is important in the preset. You there have to specify debug = true and also fill in a name for the templatesourcecode, e.g. templatesource.[extension]

When you then are offered to debug you get vs.net opened. I too got the 'there's no sourcecode'. So I clicked show assembly. then I pressed F5 and I got the sourcecode presented and could step through it.

To test, it's best to use one task at a time in a preset: simply your task to execute and test your template with that task. Them move on to the next task and so on.

Frans Bouma | Lead developer LLBLGen Pro
sickmat
User
Posts: 13
Joined: 28-Feb-2007
# Posted on: 02-Mar-2007 15:41:57   

That did it! Thank you.

I created a debug preset that contained only the task I was trying to debug and set the following parameters within the preset:

<parameters> <parameter name="debugBuild" value="true" /> <parameter name="templateAssemblySourceFileFormat" value="templatesource.[extension]" /> </parameters>

I generated the code, started the debugger and then hit F5. The source code came up and I am able to view local variables.