A few weeks ago, I was assigned the task of creating a web app for uploading or viewing files for our client company. I told them I knew a bit about front end, and they gave it to me. I had to, on the fly, learn ASP.MVC, which, to be fair, wasn't hard to grok. It's not terribly different than anything else I've done.
But a few days ago, it came time to start writing the back end. I knew nothing about Entity Framework. Not a single thing. Except it was like Hibernate, and I vaguely know what Hibernate is.
I start cracking at it anyways.
I already have my databases. Those already exist. I just need to build my models. So I do, after a jaunt to the MSDN to read about what the f**k to do.
Then I write a quick console application and attach it to my solution so I don't need to write a view just to test my code. After laboring and learning for a while, it's time to fire it up and see what happens.
And I get System.NullReference Exception: Value is null. And that's it.
System.NullReference Exception: Value is null.
Like WTF is this crap? Null? What is null? Is my connection string broken? Is my table wrong? Is my model wrong? Does the table have no data? The hell? Not even a line number to where the error is? Just "value is null"? What's this vague error mean?
About an hour or two of furious research and combing through my code it turns out I forgot to add getters and setters to one of my model's properties, which was keeping it from grabbing data from the tables. But dear god, it couldn't have been a more vague error unless it just said "error" and then shut down Visual Studio.
Finally got past that.
And then I add a table to my model, one that's referenced by a foreign key in SQL Server.
I get "System.NullReferenceException" again.
Turns out, after a few more hours of research and a Stack Overflow question, I missed an Include() in my query.
Finally after hours, my model is grabbing and displaying data from the database.
All that's left is to finish the rest of the tables and get them hooked up to my webpage, but that shouldn't be too difficult (pound on wood.)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.