Source not being escaped properely

Posts   
 
    
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 31-Aug-2006 01:33:03   

I'm trying to generate an xml file (a web.config). I'm compiling my template and i get a series of "Newline in constant" and "Unrecognised escape sequence" errors.

The end of one line of the generated template source is (from templateClassesSource.cs)

userName=\"registry:HKLM\SOFTWARE\"); it should be userName=\"registry:HKLM\SOFTWARE\");

What can I do to get around this problem?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 31-Aug-2006 09:47:12   

Could you paste the code snippet from your template which results in this code?

(btw: you could pad the string you're emitting into the output with a '\' ?)

Frans Bouma | Lead developer LLBLGen Pro
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 01-Sep-2006 04:08:07   

Hi Otis heres the entire lpt file source:


<%
Project project = _executingGenerator.ProjectDefinition;
%><?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="BuildVersion" value="1.0"/>
        <add key="CopyrightMessage" value="<%= project.CustomProperties["CopyrightMessage"]%>"/>
        <add key="ApplicationName" value="<%= project.ProjectName%>"/>
        <add key="ApplicationShortName" value="<%= project.CustomProperties["ProjectShortName"]%>"/>
        <add key="Main.ConnectionString" value="<%= project.ConnectionString%>"/>
        <add key="MaxSearchItems" value="50"/>
        <add key="EventLogName" value="<%= project.CustomProperties["ProjectShortName"]%>"/>
    </appSettings>
    <connectionStrings/>
    <system.web>
        <httpModules>
            <add name="ExceptionLogging" type="OAMPS.WEB.ExceptionCatch, OAMPS.WEB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d3fffad90f8278a"/>
        </httpModules>
        <compilation debug="false">
            <assemblies>
                <add assembly="ComponentArt.Web.UI, Version=2006.1.1283.2, Culture=neutral, PublicKeyToken=9BC9F846553156BB"/>
                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            </assemblies>
        </compilation>
        <pages>
            <namespaces>
                <clear/>
                <add namespace="System"/>
                <add namespace="System.Collections"/>
                <add namespace="System.Collections.Specialized"/>
                <add namespace="System.Configuration"/>
                <add namespace="System.Text"/>
                <add namespace="System.Text.RegularExpressions"/>
                <add namespace="System.Web"/>
                <add namespace="System.Web.Caching"/>
                <add namespace="System.Web.SessionState"/>
                <add namespace="System.Web.Security"/>
                <add namespace="System.Web.Profile"/>
                <add namespace="System.Web.UI"/>
                <add namespace="System.Web.UI.WebControls"/>
                <add namespace="System.Web.UI.WebControls.WebParts"/>
                <add namespace="System.Web.UI.HtmlControls"/>
            </namespaces>
            <controls>
                <add tagPrefix="ComponentArt" namespace="ComponentArt.Web.UI" assembly="ComponentArt.Web.UI, Version=2006.1.1283.2, Culture=neutral, PublicKeyToken=9bc9f846553156bb"/>
                <add tagPrefix="omp" tagName="Navigation" src="~/Home/Navigation.ascx"/>
            </controls>
        </pages>
        <authentication mode="Windows"/>
        <identity impersonate="true" 
            userName="registry:HKLM\SOFTWARE\<%= project.CustomProperties["ProjectShortName"] %>\identity\ASPNET_SETREG,userName" 
            password="registry:HKLM\SOFTWARE\<%= project.CustomProperties["ProjectShortName"] %>\identity\ASPNET_SETREG,password"/>
    </system.web>
</configuration> 

and heres the generated code bit with the error:


__outputWriter.Write( project.CustomProperties["ProjectShortName"] );
        __outputWriter.Write("\identity\ASPNET_SETREG,userName\" \n         password=\"registry:HKLM\SOFTWARE\");
__outputWriter.Write( project.CustomProperties["ProjectShortName"] );

Note theres another line (directly) above this with the same error. But it's really really really long. Here it is here (put at the bottom to reduce noise)


        __outputWriter.Write("\"/>\n    </appSettings>\n    <connectionStrings/>\n  <system.web>\n      <httpModules>\n         <add name=\"ExceptionLogging\" type=\"OAMPS.WEB.ExceptionCatch, OAMPS.WEB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d3fffad90f8278a\"/>\n      </httpModules>\n        <compilation debug=\"false\">\n         <assemblies>\n              <add assembly=\"ComponentArt.Web.UI, Version=2006.1.1283.2, Culture=neutral, PublicKeyToken=9BC9F846553156BB\"/>\n              <add assembly=\"System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089\"/>\n               <add assembly=\"System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\"/>\n          </assemblies>\n     </compilation>\n        <pages>\n           <namespaces>\n              <clear/>\n              <add namespace=\"System\"/>\n               <add namespace=\"System.Collections\"/>\n               <add namespace=\"System.Collections.Specialized\"/>\n               <add namespace=\"System.Configuration\"/>\n             <add namespace=\"System.Text\"/>\n              <add namespace=\"System.Text.RegularExpressions\"/>\n               <add namespace=\"System.Web\"/>\n               <add namespace=\"System.Web.Caching\"/>\n               <add namespace=\"System.Web.SessionState\"/>\n              <add namespace=\"System.Web.Security\"/>\n              <add namespace=\"System.Web.Profile\"/>\n               <add namespace=\"System.Web.UI\"/>\n                <add namespace=\"System.Web.UI.WebControls\"/>\n                <add namespace=\"System.Web.UI.WebControls.WebParts\"/>\n               <add namespace=\"System.Web.UI.HtmlControls\"/>\n           </namespaces>\n         <controls>\n                <add tagPrefix=\"ComponentArt\" namespace=\"ComponentArt.Web.UI\" assembly=\"ComponentArt.Web.UI, Version=2006.1.1283.2, Culture=neutral, PublicKeyToken=9bc9f846553156bb\"/>\n             <add tagPrefix=\"omp\" tagName=\"Navigation\" src=\"~/Home/Navigation.ascx\"/>\n            </controls>\n       </pages>\n      <authentication mode=\"Windows\"/>\n        <identity impersonate=\"true\" \n           userName=\"registry:HKLM\SOFTWARE\");

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 01-Sep-2006 11:02:58   

Ok, got it. Seems like a little test has to be added to make this work.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 04-Sep-2006 10:31:02   

Fixed in next build

Frans Bouma | Lead developer LLBLGen Pro
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 06-Sep-2006 04:30:38   

Awesome, is that released?

worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 06-Sep-2006 04:36:27   

Hi Otis,

I've just updated to the 4th of September build and I can see still see unrecognised escape sequence errors frowning

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 06-Sep-2006 08:37:17   

odd, as my test worked as expected... confused

Could you please check if you have the right lptengine dll in the tasksperformers folder? Rightclick the dll in explorer -> Properties -> Version tab

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 06-Sep-2006 16:42:29   

It indeed gives errors still, not the ones you provided, but where a \ is located in the string. I've to replace every \ with \, excluding the newline stuff.

Will fix it.

A workaround is to specify the backslashes twice, like: userName="registry:HKLM\SOFTWARE\<%= GetName() %>\identity\ASPNET_SETREG,userName" password="registry:HKLM\SOFTWARE\<%= GetName() %>\identity\ASPNET_SETREG,password"/>

(I used the GetName() method to test the escaping of the trailing slash)

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 07-Sep-2006 12:41:54   

Fixed in next build simple_smile

Frans Bouma | Lead developer LLBLGen Pro