I was just pushing a website to production, which worked fine in a QA environment. The patch involved DLL dependency updates, and some database scripts.
I will cut to the chase and explain the error that took me 4 hours to figure out. One of my database scripts created a stored procedure, which was missing [dbo] before its name. So instead of becoming [dbo].[myProcedure] it became [shawn].[myProcedure]. When the script was executed from code via the System.Data.SqlClient library, it killed the entire ASP.NET worker process. This caused the application to restart and redirect me back to the login screen. The procedure was only called conditionally, and quite infrequently, so it was difficult to reproduce.
Because it took out the entire ASP.NET worker process, it was extremely difficult to debug. I had no way of catching the error. Eventually I noticed this in the Windows Event Log:
Exception: System.Runtime.Serialization.SerializationException
Message: Unable to find assembly 'Shawn.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
(Note: Root namespace renamed to protect the innocent.)
And then, 2 seconds later:
EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 mscorlib, P5 2.0.0.0, P6 4889dc80, P7 4687, P8 4b, P9 shawn.data.dataaccess, P10 NIL.
At this point I figured it was a mismatched assembly version, GAC conflict? or something similar. I checked every reference throughout my project, and tried tons of different things. I eventually looked for all references to the namespace Shawn.Data.DataAccess and logged to a file every few lines to find where the application was failing. This led me to the correct stored procedure.
TLDR: Why would the lack of [dbo] on a single script cause the entire ASP.NET worker process to crash?