Entity Framework - Debugging a Seed method from the Package Manager Console

Fri Feb 08 2019ProgrammingWeb Development

On the odd occasion you wish to debug Seed method code which has been executed from the Package Manager Console using the Update-Database command, a quick and dirty method is to add the following code:

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

Yes it's dirty! It will however fire up a new Visual Studio debug window and allow you to see what's going on inside.

This method will also work for any code that happens to sit outside of a normal debugging scenario.

GatsbyNetlifyReactTypeScriptTailwind CSS
© Copyright 2008-2022 Terry Butler