Sequence contains more than one element

Easiest way to debug Seed-method in EF Code-first migrations in Configuration.cs when running Update-Database

Reading Time: 5 minutes. This post was most recently updated on October 9th, 2018.This post describes the easiest way to debug the issues that may stop your Seed-method in Configuration.cs from going through. The solution here shows you, how you can get a little bit more information out of the process, without attaching the debugger (there’s another blog post for that!) Description Entity Framework’s code-first migration’s are a beautiful and easy way of managing database schema changes and populating some preliminary data there. Personally I also sometimes use the method for adding some enrichment to data or or custom property values mapping that would […]

Sequence contains more than one element

Launching a new debugger instance from code in Visual Studio

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.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 […]

Visual Studio's Attach to Process -dialog

Attaching the Visual Studio debugger to the right IIS worker process

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.Every now and then comes the time when you’d actually need to debug something, and then you’ll likely be using your Visual Studio to attach the debugger to one or more processes. Using CKSDev to attach to all IIS worker processes (w3wp.exe), or if you don’t use CKSDev, just pressing ctrl+p and selecting the processes from the list, is often a good enough solution. However, sometimes that makes your dev box sluggish, or maybe catches exceptions from code you’re not wishing to debug at the time, and it’d be handier to […]