I downvoted because

a wall of code isn't helpful

Please include the minimum amount of code in your question needed to illustrate your problem

Like the proverbial needle in the haystack, you’ve made it hard for people to find the error in your code.

Why this is a problem

There is a huge code block inside your question. Your real problem lies only in a few instructions, and most of the code posted is completely irrelevant to the resolution of your issue. It only serves as noise, and makes it harder for those trying to answer your question.

Why this is worth a downvote

The noise generated from all the code surrounding the error prevents future users from relating your question and the answer to their own issue. It also makes it much harder for anyone to determine what the problem is. That makes your question less likely to get an answer, and wastes the time of anyone who tries to help you. The question is effectively only useful to the asker, is less likely to get answered, and offers little or no value whatsoever to the community as a whole.

It also shows that not much effort was put into creating your question. People are volunteering their time, free of charge, to help you. You need to be considerate of their efforts. One of the easiest, and most helpful, ways to do this is to pare down your code to the minimum needed to illustrate your problem.

What to do next

Isolate the issue, and create a Minimal, Complete, Verifiable example (see the StackOverflow help center for more details). Such an example is generally only a few lines of code, like a function or a database request.

The code should be debugged to identify the precise spot at which the issue occurs. It should then either be rewritten from scratch until the issue reappears or the original code should be largely cut through to remove working pieces which are not directly related to the issue.

For markup (html, xml, etc), remove attributes, namespaces, styles and elements that don’t have anything to do with your issue.

If you are worried that something you have removed may play a part in your issue, state so in your question. Users with domain knowledge in your issue will let you know when they need to see additional information. Be available after you post your question and respond quickly to these requests! If you cannot, then wait until you can to post your question.

The now minimal code can be used to replace the noisy code through an edit. You can find an edit link at the bottom of your question.

Now your code can be quickly read, understood, and fixed by answerers. Future readers will be able to notice at a glimpse if their issue relates or not to your issue.

Leave a comment!

Once you have done this, leave a comment to the person who sent you this link. They will be happy to retract their downvote.

Did this page help you?

This website is here for everyone’s benefit, most importantly yours! If this did not help you, or if you would like to leave feedback, please create an Issue regarding this page on GitHub, or submit an improvement directly.