locked
Using T4 for long file failed with message "An expression is too long or complex to compile" RRS feed

  • Question

  • Hi,

    I am trying to generate a huge file (actually, I am patching an InstallShield ISM file).

    A large part of the file is constant.

    I thus have text blocks exceeding 64k.

    T4 complains with the message:

    input.tt(0,0) : error CS1647: Compiling transformation: An expression
    is too long or complex to compile

     

    I bypass the issue by inserting fake control blocks "<# #>" every 1000 lines, so that no text block between two control blocks exceeds 64k.

    The problem is that it adds manual work when updating the fixed part of my setup (by copy/pasting it from my reference ISM file).

    It is paradoxal to be forced to do such things by hand for a tool supposed to automate such tasks ;-)

    Is there an option to force T4 to split large text blocks in chunks < 64K?

    (or do you plan to do it automatically in the future?)

     

    Best regards,

     

    Luc

    Friday, August 6, 2010 9:52 PM

Answers

  • Hi Luc,

    Thanks for bringing this to out attention.

    You're the first person I'm aware of who's run across this limitation - it's a pretty uncommon scenario to use T4 to generate files of such a size as one template.

    So the answer to your questions are that:

    a) there is currently no option
    b) right now, we don't have any plans to fix this - Are there other folks out there with big files facing this issue - if so, please log a connect issue and vote it up.


    Gareth Jones - Developer Architect - T4, UML Designer Extensibility [MSFT]
    Saturday, August 7, 2010 1:43 AM

All replies

  • Hi Luc,

    Thanks for bringing this to out attention.

    You're the first person I'm aware of who's run across this limitation - it's a pretty uncommon scenario to use T4 to generate files of such a size as one template.

    So the answer to your questions are that:

    a) there is currently no option
    b) right now, we don't have any plans to fix this - Are there other folks out there with big files facing this issue - if so, please log a connect issue and vote it up.


    Gareth Jones - Developer Architect - T4, UML Designer Extensibility [MSFT]
    Saturday, August 7, 2010 1:43 AM
  • I encountered this as well. The reason I need this is I am trying to refactor exiting code which is many 10,000 line programs.

    So rather than try to write a DSL to replace the entire code.  I might write a new DSL to just handle new situations like adding 5 new tables each having multiple columns. 

    I can then simple add my t4 code at various parts where new code exists. I can work faster generating new code rather than trying do refactor the entire program.

    This approach allows me to go back with and refactor the remaining older code when I either have time or management sees the benefits of DSL/t4 code generation and approves this a project.

     


    Art Jasso
    Tuesday, March 1, 2011 10:54 PM