locked
Default WebApplication using MVC and Visual Studio 2019 - AccountController.Login() Method throws NullReferenceExceptions - Is this a bug? RRS feed

  • Question

  • User-1851576699 posted

    I'm creating a new WebApplication using Visual Studio 2019 and choosing MVC as the project template and selecting the option to use local accounts.

    When I debug the application, the Login() method of the AccountController is throwing NullReferenceExceptions. I haven't added any of my own code. Does Microsoft know this?

    It's kinda weird because the webpage for the Login.cshtml view will load just fine in the browser. You'll only see the NullReferenceExceptions if you're debuggint the Login() method of the AccountController.

    Saturday, May 23, 2020 5:13 AM

All replies

  • User-474980206 posted

    You have probably set vs to stop on caught exceptions. That is you are breaking on an error that is handled by default and is expected.

    Saturday, May 23, 2020 5:43 PM
  • User-1851576699 posted

    Yes, I agree. But my question had to do with why exceptions would even be thrown by default Microsoft code that ships this way from the factory, so to speak? Is that proper? That's the bizarre point. It's what my whole question revolves around. Why ship, or even, encourage, code that produces exceptions?

    Saturday, May 23, 2020 7:37 PM
  • User1686398519 posted

    Hi,  TheNutCracker

    I created the Identity project and debug it. There is no problem. Can you give a screenshot of your problem or describe it more specifically?

    Create project

    Debugging

    Best Regards,

    YihuiSun

    Monday, May 25, 2020 8:51 AM