So I've been writing a new Web API course Pluralsight. I am digging in how to handle versioning for an API and I think I've gotten it figured out but it just doesn't work. Throwing a crazy exception and just isn't working. I waste four hours trying to figure it out and I am cursing and grunting. The other people in the coffee shop are staring.
I spend a bunch of time on Google trying to find someone with a similar problem but no luck. Looking at the data and walking through the bug with the debugger didn't yield anything. Desperate, I reach out to Glenn Block himself for an answer. He's very gracious and agrees to help me out with a quick Skype session.
I tell him the story and he seems shocked. He's telling me things to try but I've tried most of them. I can tell by the look on his face that he doubts that this could be a bug…but it might be. So I told him I'd create a quick reproducible example so I could talk with someone on the team. With some things to try and my assignment to reproduce the problem in isolation, he left me to my own devices.
First thing I did was to create the reproducible case…and it worked. Uh oh. It wasn't a bug…it was working *exactly* as intended. Soon after I found the offending bug. I had done two important things wrong:
This happens to developers all the time. It's a knucklehead move for me specifically because this is what I tell developers they have to do. This is part of my debugging speech. I instruct them to reduce and test and repeat until you have the smallest possible set of code that shows the problem or (usually) find the bug in your own code. It works every time…guaranteed. But only when you follow the procedure.
Even more knuckleheaded was not fully reading the stack trace. This would have pointed me to the problem without even creating the repo case. It was my code that was throwing the exception. A dead giveaway. Half-a-day lost because I thought I was smarter than I am.
|Vue.js by Example (New Lower Price)|
|Bootstrap 4 by Example (New Lower Price)|
|Intro to Font Awesome 5 (Free Course)|
|Building an API with ASP.NET Core (New Course)|
|Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.2)|
|Less: Getting Started (New)|
|Using Visual Studio Code for ASP.NET Core Projects|
|Implementing ASP.NET Web API|
|Application Name||WilderBlog||Environment Name||Production|
|Application Ver||v4.0.30319||Runtime Framework||x86|
|App Path||D:\home\site\wwwroot\||Runtime Version||.NET Core 4.6.27514.02|
|Operating System||Microsoft Windows 10.0.14393||Runtime Arch||X86|