none
Errors in Code First during add-migration RRS feed

  • Question

  • Our add-migrations are failing routinely but not consistently during add-migration. The migration always gets to the scaffolding step and then roughly 4 out of 5 times we will receive something like the following:

    System.Runtime.Remoting.RemotingException: Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.
       at EnvDTE.Project.get_Properties()
       at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
       at System.Data.Entity.Migrations.Extensions.ProjectExtensions.AddFile(Project project, String path, String contents)
       at System.Data.Entity.Migrations.Utilities.MigrationWriter.Write(ScaffoldedMigration scaffoldedMigration, Boolean rescaffolding, Boolean force, String name)
       at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass3.<.ctor>b__1()
       at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
    Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.

    Sometimes the migration class gets generated anyway but more often it does not. Searches on this error have indicated that something is being garbage collected that isn't supposed to be but that doesn't really help us work around the issue.

    Our data migration project is in .NET 4.5 with EF 5 working in Windows 8, Visual Studio 2012 and SQL Server 2012.

    Any suggestions or information you may have will be greatly appreciated.

    Thanks


    Thursday, May 2, 2013 3:51 PM

All replies

  • Hi Dane,

    Yes the RemotingException: Object has been disconnected or does not exist at the server usually occurred if the object has been GC'ed.

    I searched a while but didn't find similar issues when using add-migrations. Which kind of project are you developing? WinForms, MVC or something else?

    Here is a thread talking about RemotingException. Although it is not generated using add-migrations, you may have a look whether you have disconnect the object in similar scenarios.

    http://stackoverflow.com/questions/6339469/object-has-been-disconnected-or-does-not-exist-at-the-server-exception

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 6, 2013 6:57 AM
    Moderator
  • The project is a WPF application now but I was getting the same exception during migrations performed against the same database in a console application as well. It's pretty flaky behavior. The last time I added a migration for example I got this error two attempts in a row then it added the migration correctly the third time.
    Monday, May 6, 2013 4:25 PM
  • I figured I'd ask inquire about this again. We still get this behavior ~80% of the time. I'm having to perform add-migration 3-5 times each new migration to finally get one that works. Our data model is quite large but there's obviously a bug in the migration code somewhere. 
    Friday, August 2, 2013 3:46 PM
  • Just wanted to weigh in here, since we are currently experiencing the same thing.

    Our project is a console app (with TopShelf hosting a windows service).

    The step that fails is addition of an index on a single column (varchar(10)) on a table. The table consists of about 23 million rows.

    The step is the final step in about a dozen migration steps. When I run the migration again (where only the last step i left to migrate), the migration succeeds every time.


    /Jesper www.idippedut.dk

    Thursday, October 2, 2014 12:31 PM
  • Having a similar problem when executing a complex migration.

    I found a setting in MS Sql Server 2014 in the connection tab that might be causing this:

    "Remote query timeout in seconds" is set to 600 by default.

    I've set it to zero, and it seemed like it at least ran longer before blowing up (with the same error), so maybe this setting will be a help to some.... I'm pretty certain it's a timeout problem. I'm still experimenting.



    • Edited by Derrick S Thursday, October 30, 2014 3:14 AM
    Thursday, October 30, 2014 3:13 AM
  • I'm having this issue all the time now, takes about 5 mins then errors with this.

    VS2013, EF 6.1.1 Any ideas for a solution?

    System.Runtime.Remoting.RemotingException: Object '/ef9070e4_a7b8_4520_8e1b_c817e5c57d5f/yaeeig2snam0bp7ny2kp1amz_23.rem' has been disconnected or does not exist at the server.
       at System.Data.Entity.Migrations.Utilities.DomainDispatcher.WriteLine(String text)
       at System.Data.Entity.Migrations.MigrationsDomainCommand.WriteLine(String message)
       at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
       at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
       at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
    Object '/ef9070e4_a7b8_4520_8e1b_c817e5c57d5f/yaeeig2snam0bp7ny2kp1amz_23.rem' has been disconnected or does not exist at the server.


    Monday, January 19, 2015 3:59 PM
  • This happened to us today. We tried to increase the timeout time using solution from here: http://stackoverflow.com/a/26074522/292787 . It was still failing in package manager console. But in a simple custom console application it worked fine. I think that it's a bug in visual studio or in the update-database part.
    Monday, January 30, 2017 6:19 PM