Wow! Hard-to-find bugs can really give you insight into how the .Net Framework works. I recently just battled an elusive bug that turned out to be quite simple. In a history table, I logged events. Each event had a description that a user could type in. Well, I noticed that longer descriptions were being cut off short. I looked at the database and noticed that my nvarchar(50) field was the culprit. So I just changed it to nvarchar(4000) to give the users the most flexibility. I change the corresponding stored proc to mimic the new field length and then went to test the change. No dice. It still cut off my description. What gives?
ADO.NET!!! I use an ADO.NET command to call my stored procedure. The description was being truncated in the ADO call. I restarted the app, and it worked fine. ADO caches information about sproc parameters, and I had to restart the app for that cache to be recreated with the new length.