problem with output/.log files

Oct 1, 2009 at 8:03 PM
Edited Oct 1, 2009 at 9:01 PM

I have a problem when I use Link to sql model code generation template.  

If the log file is output and exists in directory.  All my winforms will NOT display in the designer.  I get this error: An error occurred while parsing EntityName. Line 2, position 66.

I have tested this pretty extensively and I think it comes down to a directory path issue.  My project is on a path that contains an "&" symbol. No, I cannot change the path...too many other projects are under this path.  I moved my project to another path and everything works as it should...So I am nearly postive that this is a problem. 

As a work around, what I do is delete the .log file and everything seems to work fine again in my forms, but this is quite a pain since I am back and forth right now working on my model and form.  By the way, most of the common windows controls work me if I use them.  It is third party components that cause a problem.  For me it is specifically Infragistics, but I have tested with others and it produces this error.

So my question is can I stop this file from ouputing?  I have tried many things already and it does not work.  Strange error this is and took me a little bit to track down.

I am using visual studio 2008 sp1 and I think the latest t4 toolbox either the latest alpha or beta, not 100% sure here.

Thanks in advance for you help

btw, this same problem occurs with the LINQ to SQL templates for T4 also, so I don't know exactly were the problem is?  Deleting the log file in this template doesn't work though!

Brian

Coordinator
Oct 1, 2009 at 9:58 PM

I'm sorry, I'm lost. Is it WinForms or LINQ to SQL? Could you provide step by step instructions on how to reproduce the error?

Thanks,
Oleg

Oct 2, 2009 at 6:02 AM

Thanks for responding Oleg. Yes, here are the steps

1. Create a folder, for example called Test & Temp.  or any folder with a "&" symbol.

2. Create a new windows forms project under this folder.

3. Add a new item: Linq to SQL Model  to the project above.  

4. Add a database and tables to the Model.

5. Go into the .tt template file and save.

6. Go into the windows form form1.cs.

7. If I try to add a CrystalReportViewer for example I get this error: Failed to create CrystalReportViewer.  The error is a follows.  System.Xml.XmlException:An error occurred while parsing the Entity Name.  Line 2, position 69.

8. Right Click and remove the .tt file from project and go into the form again and see that you can add controls.

This error also occurs for alll infragistics controls, where I first noticed the problem, because I added an existing form to my project that had infragistic controls and then I started seeing the error in the designer.

Hope these steps help you isolate the problem. 

 

Coordinator
Oct 2, 2009 at 10:36 AM

So the problem occurs in the Windows Forms designer when the project has a .tt file in it? Can you duplicate this problem with standard Windows controls (I don't have access to Crystal or Infragistics at the moment)?

Oct 2, 2009 at 11:22 AM

Oleg, yes it does appear to be a .tt file problem after testing some more.  If I add a .tt file to the project then I close and reopen I have the problem.  I am only able to reproduce it with CrystalReportViewer and Infragistics winform controls.  Strange?

Oct 2, 2009 at 11:28 AM

By the way if I remove the & symbol in the folder this goes away.  This appears to be a bug with .tt files, so I guess that means it is a Microsoft bug.  

Coordinator
Oct 2, 2009 at 12:18 PM

Brian, I can't duplicate the problem based on this description. Please let me know if you figure out a way to reproduce it with standard .NET controls. If this turnes out to be an issue with Crystal and Infragistics, it may be better to contact the vendors directly.

Oleg

Oct 2, 2009 at 2:17 PM

OK Oleg, but you tried only with standard controls I guess.  

The crystal report viewer control is what comes with visual studio,  I think, not sure using Team version at work?  

This problem is a little bit of a pain, but the simplest solution I have found is to change the path and not have an "&" symbol, so that is the route I am taking.

Thanks for you help!  

By the way, you have done an excellant job with T4.  It has helped me greatly.  Thank you for all your great work and tutorials!!

I am finding all kinds of things I want to use T4 for now and I just begun using it. :)

Brian