locked
T4 - Runtime.Remoting.RemotingException during runner RRS feed

  • Question

  • Hi all, am running quite a big generation process (using T4Toolbox) and I am getting the error below. Now all the files *seem* to be getting created, but there are hundreds and it is difficult to verify this, so would just like to get an idea what the error is about, if it is a problem and how to fix it if so.

    My script is querying a EF model to get the data to generate and it currently takes about 16 minutes to run. I don't get this error on smaller T4 jobs using the same base classes, so guess it has something to do with this. Is there a timeout that I need to set somewhere?

    ---------

    Error 2 An Exception was thrown while running the transformation code. The process cannot continue.  The following Exception was thrown:
    System.Runtime.Remoting.RemotingException: Object '/e9919707_51b9_4880_84da_dee6f5ffedb6/dbrzwgoe3yuyszzr561_9gpx_14.rem' has been disconnected or does not exist at the server.
       at Microsoft.VisualStudio.TextTemplating.TransformationRunner.get_Errors()
       at Microsoft.VisualStudio.TextTemplating.Engine.CompileAndRunCode(String generatorCode, ITextTemplatingEngineHost host, TemplateProcessingSession session) C:\Users\bgerhardi\Documents\Development\Working Directories\Evolution\Vapour\EvoImportModelConnector\UseCases\Generate Import Tables.tt 0 0 

    • Moved by Nancy Shao Monday, June 14, 2010 6:22 AM EF question (From:Visual Studio Extensibility)
    • Moved by Jonathan Aneja -- MSFT Thursday, June 24, 2010 11:16 PM (From:ADO.NET Entity Framework and LINQ to Entities (Pre-Release))
    Friday, June 11, 2010 4:59 PM

Answers

  • Hi Brett,

    You're right, the .Net remoting used across T4's AppDomain is falling foul of the default .Net remoting timeout.

    Historically, customers haven't created individual templates that run long enough for this to be a problem, but I can see that introducing T4Toolbox gives the opportunity to make much larger single root templates.

    The only workaround I can suggest is to split up the root template on some criteria to partition the time.

    Please can you log a bug via https://connect.microsoft.com/VisualStudio against T4 so we can consider adjusting the timeout or making it a parameter for a future version.

     

    As you say, this may be benign, as the calls back to DTE from T4toolbox will be going over COM which doesn't suffer from the timeout.

     


    Gareth Jones - Developer Architect - T4, UML Designer Extensibility [MSFT]
    Tuesday, June 29, 2010 4:38 PM

All replies

  • Hi Brett,

    I am moving this thread from Base "Visual Stuido Extensibility" forum to the "ADO.NET Entity Framework and LINQ to Entities" forum, since the issue is related to Entity Framework. There are more Entity Framework experts in the "ADO.NET Entity Framework and LINQ to Entities" forum.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, June 14, 2010 6:21 AM
  • Hi Nancy, this problem is *related* to Entity Framework, however I believe it is more related to T4Templates as this is what is actually exceptioning (TextTemplating is T4 not EF) and so I believe that the problem is due to a T4 job taking a long time to run.

    I could be wrong, however if you agree could you move this back please? Thanks

    Monday, June 14, 2010 8:10 AM
  • Hi Brett,

    Sorry for moving to wrong forum. But I have no right to move thread in this forum, Could some moderators please help me move this thread to "Visual Studio Extensibility" forum back? Or Brett, could you please post a new thread in "Visual Studio Extensibility" forum?

    About this issue, I suspect the database is too large, so I would suggest you try to use a small database with a small quantity of tables to see if it still happens. Or try to use a local DB server rather than remote. Please check the following thread with similiar issue:

    http://stackoverflow.com/questions/2299081/vs2008-t4-subsonic-error-on-dbs-with-many-tables-system-runtime-remoting-remoting

    If all does not help, could you post your T4 file here for me to repro this issue?

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 16, 2010 3:18 AM
  • No the database is very small. I just have an Entity Framework model with 10 tables/views in it. It wouldn't be practical to provide the code here (too complex). However I suspect that if you created a t4 template that simply had a delay in it of 15 mins, you might get the same error. The question is what can we do about it? Doesn't the exception give any clues? What part of the t4 system uses remoting and what is the .rem object referring to?

    In my situation The tt is a preprocessed template (based on the t4toolbox) and relies on a bunch of other classes to build the text, The template is then called from a t4toolbox generator, that loops round records from the Entity Framework table and adds the generated files to a dbproj file. I call the t4 generator from a single tt file.

    It certainly is a timeout, however I don't think it is the size of the database that is the problem but possibly the time that it is taking to complete.

    Is there any way to increase the timeout for remoting?

    I'm still not sure that the exception actually affects my output (I think all files are being created correctly), it is just a worrying error.

    Tuesday, June 29, 2010 3:10 PM
  • Hi Brett,

    You're right, the .Net remoting used across T4's AppDomain is falling foul of the default .Net remoting timeout.

    Historically, customers haven't created individual templates that run long enough for this to be a problem, but I can see that introducing T4Toolbox gives the opportunity to make much larger single root templates.

    The only workaround I can suggest is to split up the root template on some criteria to partition the time.

    Please can you log a bug via https://connect.microsoft.com/VisualStudio against T4 so we can consider adjusting the timeout or making it a parameter for a future version.

     

    As you say, this may be benign, as the calls back to DTE from T4toolbox will be going over COM which doesn't suffer from the timeout.

     


    Gareth Jones - Developer Architect - T4, UML Designer Extensibility [MSFT]
    Tuesday, June 29, 2010 4:38 PM
  • Looks like we don’t have any workaround for this issue...I tried by setting connection timeout=0 and command timeout=0, but it did not help :(

    Thursday, August 2, 2012 9:03 AM
  • Hi Brett,

    ...You're right, the .Net remoting used across T4's AppDomain is falling foul of the default .Net remoting timeout.... As you say, this may be benign, as the calls back to DTE from T4toolbox will be going over COM which doesn't suffer from the timeout.

     


    Gareth Jones - Developer Architect - T4, UML Designer Extensibility [MSFT]

    Dear Brett --

    Your post is quite old.

    I am sorry, but I must beg to differ with the "mark as answer" because this still seems broken from my end.

    This RemotingException is still happening now, in the year 2012, so I am wondering if there is any fix around for VS 2010?

    What do you think?

    Is there anything we can do except to refactor our T4 templates (which is a lot of work) right now?

    Can you help?

    (The odd thing that is happening here is that the timeout error occurs only on the 1st attempt to run the templates. After that, if one just clicks Transform All, then they run without a timeout. That is weird to me.)

    Thanks.

    -- Mark Kamoski


    • Edited by mkamoski2 Thursday, September 20, 2012 6:32 PM Added pertinent facts.
    Thursday, September 20, 2012 6:31 PM
  • Is there any update to fix this? I am facing this issue as of now :(
    Tuesday, August 20, 2013 12:44 PM
  • It's been 5 years since the bug was posted. Has there been a resolution? I am experiencing the same issue while code generating interfaces from a restful service endpoint. It worked fine, but as the web service has grown it now takes too long and throws exceptions. It always error after processing the same amount of endpoints, so I am guessing there could be a hard coded call to TextTransformation.Dispose() after x enumerations or similar somewhere in VS .

    Could someone please respond with the status.


    • Edited by Jdubya Wednesday, February 21, 2018 1:59 PM
    Wednesday, February 21, 2018 1:58 PM