Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Baulch 1 post 21 karma points
    Oct 31, 2017 @ 20:47
    Peter Baulch
    0

    Debugging in VS2015 NullReferenceException Error is occurring on the previous razor line

    Hi, I am using Umbraco 7.7.4 and I am getting an NullExceptionError. The error is being reported at the previous razor code line to the actual error line which took me ages to work out that it was the next line that was Null.

    Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error: 

    Line 3: @{ Line 4: var theModel = Model; Line 5: var callingPageId = ViewBag.ModelId; Line 6:
    Line 7: }

    The debugger is stopping at Line 5:

    But the Null reference is actually at Line 9: ScreenClipping .cshtml

    It would have saved me a couple hours had the debugger reported the correct line as there is no content in the backend for this property - so easily fixed! Do I need to set something else or is this a know bug with ASP.Net Razor debugging?

Please Sign in or register to post replies

Write your reply to:

Draft