4

I'm asking about this particular question. It was almost immediately downvoted and unilaterally marked as a duplicate of a post explaining in rather generic terms what a Null Reference Exception is (I suspect mostly because the original title contained the word "NullReferenceException").

I'm already perfectly aware of what a null reference exception is, and the duplicate post doesn't help in the least.

Can anyone explain why it might have been marked as a duplicate?

2 Answers 2

3

As Servy says, your question may not contain an MVCE - but that doesn't change that it doesn't look like a duplicate of the other question. I've reopened it.

14
  • Since you fully realize that the question merits closure for a different reason, why didn't you close it for that reason?
    – Servy
    Mar 13, 2017 at 16:29
  • @Servy Because I don't have a C# console handy. You're free to vote as you may.
    – Undo Mod
    Mar 13, 2017 at 16:30
  • What in the world would you need a C# console for?
    – Servy
    Mar 13, 2017 at 16:32
  • @Servy If I'm going to say that something doesn't contain an MVCE, I need to be able to test it or know to a degree of certainty that it doesn't. I can't do that right now. You, and others, are either able to do that or have enough knowledge of the specific field to say with great certainty that there isn't enough there to reproduce it. Great. Close it.
    – Undo Mod
    Mar 13, 2017 at 16:35
  • There is no code to run, so why in the world would you need to be able to run code not shown to see if it in fact runs. The code uses a variable without showing its definition or where it's set, and asks why it's null. Being able to run code would do nothing to help you here. If you don't feel confident in your knowledge of the field to then why in the world would you vote to reopen it?
    – Servy
    Mar 13, 2017 at 16:37
  • 1
    @Servy I'm not sure what you're referring to, I do show where the variable is defined and set - it's right at the top of the question. Please check my latest edit that clarifies that further. Mar 13, 2017 at 16:39
  • @EJoshuaS That's not the definition of a C# variable. It's HTML code.
    – Servy
    Mar 13, 2017 at 16:40
  • 1
    @Servy It's ASP.NET Web Forms - the fact that I set the ID to tblWeekCalendar and added the runat="server" attribute causes the C# variable to be created. Mar 13, 2017 at 16:43
  • 2
    @Servy Are we looking at the same question? i.stack.imgur.com/tL6nt.png. No, I'm not confident enough to run C# in my head right now. That doesn't mean I'm not confident enough to say it shouldn't be closed as a duplicate.
    – Undo Mod
    Mar 13, 2017 at 16:43
  • @Undo You need to run code in your head to know that seeing the usage of a purportedly null variable with no declaration or initialization doesn't provide enough information to explain to the author why it's null? But you are confident in saying that a question asking why a variable isn't null isn't a duplicate of a question that explains what you should do when a variable/value is unexpectedly null?
    – Servy
    Mar 13, 2017 at 16:46
  • 1
    At some point, you have to draw the line - I could ask how Turing machines work, get an answer for that, then go close every question on the site as a duplicate of that one in the spirit of "all the information you need is there, figure it out". Also, I'm done debating this. You're welcome to vote as you like; I don't override the community twice in these things.
    – Undo Mod
    Mar 13, 2017 at 16:48
  • @EJoshuaS Yes, there might be C# code created that declares a variable and populates it based on that markup, but no, that markup is not the declaration of a variable.
    – Servy
    Mar 13, 2017 at 16:52
  • @Undo I would find it a bit odd to see an explanation for what to do when you dereference a null variable in C# in a question asking about how turing machines work. On the other hand, in a question specifically asking how to fix a null reference exception which is literally the exact problem the OP is asking about I would actually expect to find an answer. The OP is asking how to fix a NRE, the duplicate is specifically how to fix an NRE. How is that crossing any lines?
    – Servy
    Mar 13, 2017 at 16:54
  • 1
    @Undo I had the same exact problem with the same exact question - that post is way too broad for many of the sort of specific issues developers will run into. If the response to specific questions is going to be "here, go read this book and figure it out for yourself", this might as well be Wikipedia. I think this topic needs a lot more discussion and perhaps guideline clarification.
    – Randy Hall
    Mar 30, 2017 at 14:01
-4

The duplicate doesn't just tell you what a NRE is. It tells you how to go about debugging instances of it, how to find out what is null, why it's null, and how you can go about fixing the code going forward.

As it is your question isn't really answerable. "Why is some code that I haven't shown producing a null value?" If you prefer, the question could be closed for not providing a reproducible example, but someone decided to go out of their way to close it as a duplicate of a question that will give you advice on how to debug the problem instead.

5
  • 1
    But my post said exactly what variable was null, and I did show what code was producing the exception. There's a lot of code in my question. Mar 13, 2017 at 16:26
  • @EJoshuaS Yes, you know what variable is null. You don't know why it's null. Since you provided none of the code that produces that variable, nobody could possibly tell you why it's null. That you've provided lots of code that's irrelevant to your problem doesn't change that.
    – Servy
    Mar 13, 2017 at 16:27
  • 4
    That's a valid reason to vote to close a question, but it's not a valid reason to mark it as a duplicate. By that logic, we should just mark anything related to null as a duplicate of that question.
    – Undo Mod
    Mar 13, 2017 at 16:28
  • @Undo The fact that the duplicate tells them how to solve their problem isn't a valid reason to mark it as a duplicate? Since when? By that logic, no question is ever a duplicate of any other question.
    – Servy
    Mar 13, 2017 at 16:28
  • 2
    I did show the code that produces the variable, although in retrospect its formatting was a little difficult to read - I edited to clarify that that's what the variable that I was referring to. Mar 13, 2017 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .