Search code examples
entity-framework-5

Debugging Package Manager Console Update-Database Seed Method


I wanted to debug the Seed() method in my Entity Framework database configuration class when I run Update-Database from the Package Manager Console but didn't know how to do it. I wanted to share the solution with others in case they have the same issue.


Solution

  • Here is similar question with a solution that works really well.
    It does NOT require Thread.Sleep.
    Just Launches the debugger using this code.

    Clipped from the answer

    if (!System.Diagnostics.Debugger.IsAttached) 
        System.Diagnostics.Debugger.Launch();