Debugging LPT in Template Studio Locks DLL

Posts   
 
    
ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 28-Apr-2006 05:51:10   

When I am in Template Studio and I run a "Generate Task" with it set for debugBuild="true", it locks the DLL on the next execution of the "Generate Task".

I get the following error the next time I try to run a Debug:


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.

When I I check ProcessExplorer, the process that has it locked is TemplateStudio.exe.

Why is this occuring? Why won't it release it's lock after I exit the debugger? Are there special settings I have to set in the "Task" to cause it to release the DLL file after it is done?

Thanks.

Andrew.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 28-Apr-2006 08:20:59   

I'll look into the locking issue.

Frans Bouma | Lead developer LLBLGen Pro
ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 04-May-2006 01:34:51   

Any word on this?

I just thought of it again since I'm creating another template and the locked DLL issue is "pinking" me in the head...disappointed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 04-May-2006 08:39:48   

I'll look into this this morning.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 04-May-2006 11:01:16   

THe weird thing is: I did get the lock ONCE, though only when I forgot to set a Debugger.Break() statement. When I added that statement to the template, I could debug away and hit the break point every time, close the session, restart the generation of the template etc.

Did you also add the debugger break statement to the template as suggested in the tutorial ?

Frans Bouma | Lead developer LLBLGen Pro
ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 04-May-2006 17:56:15   

RE: Debugger.Break: Yes, althought I do sometimes comment it out...I wonder if the problem is with building with "debugBuild=True" without the "Debugger.Break" statement and then trying to debug later...could be that it is the combination of building a debug build and not debugging that is causing the problems.

Perhaps I am debugging incorrectly.

For me, I sometimes step into the debugger, other times I just output the code...I only step into the debugger when I have a "bug" to track down, so many times I just build and let the code output and see if it does what I want (I also put various _outputWriter() statements in to check status).

I also have my "Task" set to "debugBuild="false"" and try to set this with the "Single Task" execution parameters - I assume the one in the "Single task" params overwrites the one in the "Task" - is that correct?

I will try the following today and post my results: 1) Open a fresh Template Studio (with the DLL files deleted prior to opening) 2) Set all the debugBuild= to FALSE 3) Build numerous times 4) Set debugBuild="True" and set Debugger.Break 5) Debug and step into debugger. 6) Exit Debugger 7) Try debugging again

I will also try steps 1-3 with the following changes to steps 4ff 4) Set debugBuild=True, NOT set Debugger.Break 5) Build code (it should not break, although it will build PDB files 6) Add Debugger.Break into code 7) Rebuild, try to debug - this time it should step into the debugger 8 ) Exit Debugger 9) Try debugging again - if I am correct, this should generate the error.

I'll let you know results.

Thanks for your help.

Andrew.

ADF1969
User
Posts: 37
Joined: 28-Mar-2006
# Posted on: 04-May-2006 18:30:35   

ADF1969 wrote:

I will try the following today and post my results: 1) Open a fresh Template Studio (with the DLL files deleted prior to opening) 2) Set all the debugBuild= to FALSE 3) Build numerous times 4) Set debugBuild="True" and set Debugger.Break 5) Debug and step into debugger. 6) Exit Debugger 7) Try debugging again

I got the same error as soon as I tried to debug the 2nd time (at Step 7) - I was using the .NET CLR 2005 Debugger

I tried it next with the VS2005 IDE. Same error - I also ensured that both debuggers were exited and not running before I tried to run a "debug" again.

ADF1969 wrote:

I will also try steps 1-3 with the following changes to steps 4ff 4) Set debugBuild=True, NOT set Debugger.Break 5) Build code (it should not break, although it will build PDB files 6) Add Debugger.Break into code 7) Rebuild, try to debug - this time it should step into the debugger 8 ) Exit Debugger 9) Try debugging again - if I am correct, this should generate the error.

This also caused the error at Step 9

Perhaps having a copy of my "Task" that I am using would help. Here it is:


            <task name="Dvx_EntityTestFixtures" assemblyFilename="SD.LLBLGen.Pro.LptParser.dll" taskPerformerClass="SD.LLBLGen.Pro.LptParser.DotNetTemplateEngine">
                <parameter name="destinationFolder" value="UnitTests"/>
                <parameter name="failWhenExistent" value="false"/>
                <parameter name="clearWhenExistent" value="true"/>
                <parameter name="filenameFormat" value="[elementName]EntityFixture.[extension]"/>
                <parameter name="templateAssemblySourceFileFormat" value="Dvx_EntityFixture.[extension]"/>
                <parameter name="templateID" value="Dvx_EntityTestFixtures"/>
                <parameter name="encoding" value="ascii"/>              
                <parameter name="emitType" value="allEntities"/>
                <parameter name="debugBuild" value="false" />
            </task>                     

So, still not working - any suggestions...?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 05-May-2006 09:49:47   

I'll see if I can reproduce it with your repro steps, and see whats to do about it.

TemplateStudio does compile with the .NET 1.1 compiler, so I'm not sure if that's the problem, but either way I'll see what's causing this.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 06-May-2006 13:54:35   

I think it's caused by the fact that the debugger attaches to the templatestudio appdomain, as the code generator runs inside that process. It then locks the .pdb file, which is not overwritable after the debugger leaves because the lock isn't lifted.

The debugbuild is always to disk, which was a requirement for the debugger to be able to read .pdb info. I could try a random folder, though that would create a new random folder for each time you build the assemblies. I don't know if that's a good idea...

Frans Bouma | Lead developer LLBLGen Pro