Best practices for debugging ASP.NET MVC Binding

前端 未结 5 904
Happy的楠姐
Happy的楠姐 2020-12-01 05:44

Can you give me any general advice on how to debug ASP.NET MVC Binding?

When everything works as expected, ASP.NET MVC is great. But if something does not, like some

5条回答
  •  遥遥无期
    2020-12-01 06:46

    From Visual Studio side:

    • Set a breakpoint on entry to your endpoint.
    • Open the Immediate via the Debug menu option.

    Type in ModelState.Keys.ToList()

    • This will show the binding errors by name/key.

    Better yet type in ModelState.Values.ToList()...

提交回复
热议问题