Launching a new debugger instance from code in Visual Studio

Sequence contains more than one element

This post describes a quick solution to launching a new Visual Studio instance for debugging the code. Where I’ve found this exceptionally useful, has been in debugging code-first migration’s (one of the ways for database initialiation in .NET) Seed-method. It is by default undebuggable, as when you are running Update-Database you can’t really use a -debug switch or anything, and there’s really no way to launch the debugger. Hence the best you can do is using -verbose to get more information.

However, if you actually want to see what is happening in the code, here’s the solution.

Continue reading

Fixing error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'”

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

This post describes the fix to error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'”, which Visual Studio throws at your face when you try to run an application on any Windows-based system (or which you’ve dug out of event logs). Also, you’re probably using Entity Framework in your project.

Error

When debugging/running your code you get an error like this:

The running of the program is stopped there, and removing and readding the nuget packages and/or other references to dlls does not help. I tried also making all kinds of changes to my web.config, but nothing seemed to help. There’s a simple fix available, though!

Continue reading