Why is Visual studio referencing the wrong row during exceptions?
Some simple rows of code below:
string[] countries = new string[1];
string[] cities = new string[1];
countries[0] = "USA";
countries[1] = "England";
cities[0] = "Chicago";
When Visual Studio throws the null exception it references the following row and not the row where the exception occurred:
I know the line number is correct when you view details of the problem. However, I ofte开发者_如何学运维n spend more time than necessary searching the wrong variables because the visual representation of the exception was wrong.
Is it possible to tweak VS or do something else to solve this issue? Is it a known problem or is it just me?
This is apparently a known bug.
I am not sure that the bug @CodeNaked referenced is what you are experiencing. I know that I have gotten this a lot when debugging code that has changed and needs to be recompiled. I would try a clean and rebuild.
精彩评论