Radu - Adrian BuhaPro Student 4,504 Points
System.NullReferenceException shows in Browser not in Visual Studio. What can I do to change that?
So, as the tittle says, my System.NullReferenceException shows inside the browser, and the Visual Studio works just fine ( I mean, it doesn't shows me any errors), therefore I cannot "trace" the error using the "Autos" window as James does. Any ideea on how to change this? Thanks
Allan ClarkTreehouse Moderator 10,799 Points
Without seeing the code being executed I can only conjecture what the difference would be. Since the null reference is happening on the front end in Razor it isn't guaranteed that VS will pop up with the normal exception window. It all depends on what point in the page's life cycle that the null variable is being accessed. You should still be able to drop a break point in the controller and step through the code to find what is causing the Model being sent to the view to be null.
If you need further assistance please post the code being executed for both the controller action and the Razor page. (for info on how to post formatted code click 'Markdown Cheatsheet' link)
Great investigative question! Keep up the good work! Happy Coding!