none
Cannot step-into a shim while debugging RRS feed

  • Question

  • We have a few users running Visual Studio 2013 (update-2, Premium) that can successfully debug unit tests that have Microsoft.Fakes shims, but cannot step into the actual shimmed code... they can step into the target code, but not the shimmed code.

    FYI - the Shims wilfunction properly and intercept the calls... just no stepping into them.

    Shim example:

            public void ShimSendMessage([CallerMemberName] string property = null)
            {
                ProjectX.Messaging.Fakes.ShimQueueBase.AllInstances.SendMessageIMessage = (@base, message) =>
                {
                    if (!string.IsNullOrWhiteSpace(property))
                    {
                        _testSpecsList.Add(new TestSpecs { ShimName = "ShimSendMessage", TestName = property });
                    }
                    return "MessageId";
                };
            }


    Wednesday, June 4, 2014 3:53 PM

Answers

  • Via trial-n-error, I discovered that the solution is to check the following setting: "Enable Just My Code" within the "Debug > Options and Settings..." menu item.  Once this is enabled, you can step into the shimmed code.

     
    Friday, June 13, 2014 11:27 PM

All replies

  • Hi Sean,

    Do you get any warning or error message when you debug it with Step Into?

    The unit test project is not the executable app, so we couldn’t debug the test project with the option under the “DEBUG” menu directly, you could add a breakpoint before the shim code, and then right click your test method in test explorer window->debug your test, you could use the Step Into when the breakpoint was hit.

    But if you get the warning like this screen shot, you could disable the specific settings:

    Go to Tools > Options menu in Visual Studio.

    Go to Debugging > General menu item in left pane.

    Disable “Step over properties and operators (Managed only)”.

    Reference:

    http://stackoverflow.com/questions/4873225/step-into-property-function-f11-doesnt-work-as-expected

    Best Regard,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 5, 2014 10:12 AM
    Moderator
  • Via trial-n-error, I discovered that the solution is to check the following setting: "Enable Just My Code" within the "Debug > Options and Settings..." menu item.  Once this is enabled, you can step into the shimmed code.

     
    Friday, June 13, 2014 11:27 PM
  • Glad to know that you resolved it, thank you for sharing your solutions here.

    Have a nice day,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 16, 2014 1:35 AM
    Moderator