locked
Can't debug application when 'just my code' is disabled RRS feed

  • Question

  • User325199404 posted

    I'm having all kinds of issues debugging an ASP MVC 5 application.  If I run the application with 'just my code' disabled the application throws an exception at startup.   I get:

    'System.NullReferenceException' in System.Web.Mvc.dll

    With a stack trace of:

       at lambda_method(Closure , LoginViewModel )

    The debugger points me to a razor cshtml file that is part of the login process (identity 2).  

    NOW, if If I enable Just my code everything works BUT then I get a warning that I am trying to run 'Just my code in a release build' and if I continue anyway with this warning I no longer get exceptions thrown in visual studio.  I just get the error/stack trace info in the web browser.

    Both of these issues seemed to come out of nowhere.  Things worked and then didn't.  I went back to a previous commit and the issues remain.

    I am stuck where I can't properly debug my application.

    Thanks,

    Brian

    Tuesday, January 26, 2016 5:09 AM

Answers

  • User-166373564 posted

    Hi,

    Both of these issues seemed to come out of nowhere.  Things worked and then didn't.  I went back to a previous commit and the issues remain.

    Here are a few suggestions that might help:

    •Cleaning and rebuilding your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    •Stop your existing application and ensure that you don't have any additional IIS processes or instances of your local Web Server running.

    • If these issues are still persisting after the above steps, try restarting Visual Studio (and even your local machine)

    •If you are dealing with multiple Projects, ensure that the Project that you have a breakpoint in is actually running (Right-click your Solution > Set Startup Projects... > Ensure your current Project is selected)

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 27, 2016 2:56 AM

All replies

  • User-166373564 posted

    Hi,

    Both of these issues seemed to come out of nowhere.  Things worked and then didn't.  I went back to a previous commit and the issues remain.

    Here are a few suggestions that might help:

    •Cleaning and rebuilding your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    •Stop your existing application and ensure that you don't have any additional IIS processes or instances of your local Web Server running.

    • If these issues are still persisting after the above steps, try restarting Visual Studio (and even your local machine)

    •If you are dealing with multiple Projects, ensure that the Project that you have a breakpoint in is actually running (Right-click your Solution > Set Startup Projects... > Ensure your current Project is selected)

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 27, 2016 2:56 AM
  • User325199404 posted

    Cleaning the solution does fix it for at least one time running the application.  Unfortunately I have to either clean the solution or check and uncheck the 'optimize' checkbox in the build options every 2 or 4 times I build or I get the same error.  It appears to be a visual studio bug that MS is aware of, see this link:

    http://stackoverflow.com/questions/31992705/vs2015-project-no-longer-runs-in-debug-mode

    It's a real pain to constantly have to keep doing this so often.  Hopefully they will get it handled soon.

    Friday, February 5, 2016 7:32 PM