Visual Studio 2015 crashing each time I run Update-Database

ef-code-first ef-migrations entity-framework entity-framework-6 visual-studio-2015

Question

Visual Studio 2015 crashes every time I execute Update-Database from the package manager console. Unexpectedly, my migrations configuration is currently operating. technique of seeds at the time. Do you know where I should look to learn more about what's happening?

1
5
9/3/2015 9:21:42 PM

Popular Answer

There is a non-trivial likelihood that the project's code, rather than the inner workings of Visual Studio, is to blame for the crash.

The first step is to add the following code at the start ofSeed() ¹:

if (System.Diagnostics.Debugger.IsAttached == false)
{
    System.Diagnostics.Debugger.Launch();
}

When you do this, a prompt will show up, asking you whether you want to start the debugger in a fresh instance of Visual Studio or one that is already running.

Following that, unhandled exceptions will be considered as break points, with the offending line of code being highlighted, exception details, and all that. The debugger's output will then be logged to the VS instance's Debug output.

My crash was brought on by a recursiveset() operation in one of the entities' members, which led to aStackOverflowException .


¹ you mayDbMigrationsConfiguration If the crash occurs earlier, call the constructor of the subclass. or perhaps somewhere else.

² So keep in mind to comment out that code when you aren't using it.

3
5/23/2017 12:17:30 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow