Visual Studio - How to change the return value of a method in the debugger?

前端 未结 6 492
轻奢々
轻奢々 2021-01-02 08:12

When I\'m debugging, I often have to deal with methods that does not use an intermediate variable to store the return value :

   private int myMethod_1()
            


        
6条回答
  •  臣服心动
    2021-01-02 08:37

    I think you can do it in Visual Studio but that feels dirty to me.

    My thoughts are you should really be looking into a unit testing framework and mocking so that you can fake the output of myMethod_2 as a 0 and see what effect it has on your code. IMO. This way you can leave the return 0 check in the unit test to make sure the ugly bug doesn't stick its head up again.

提交回复
热议问题