harvzor
harvzor

Reputation: 2908

Visual Studio - disable stepping into source code of module (Shouldly)

I am using a an assertion framework called Shouldly for C#.

The code looks like this:

[Fact]
public void SimpleTest()
{
    false.ShouldBe(true);
}

This is the same as:

[Fact]
public void SimpleTest()
{
    Assert.True(false);
}

However, when I debug the example that uses Shouldly, this happens:

enter image description here

But I want this to happen:

enter image description here

The issue

When I debug with Shouldly, Visual Studio steps into the source code of the Shouldly package. I don't want to see the internals, I just want to see what line of the test my code broke on. I can use the Stack Trace to find what line my code broke on but this slows down my flow a lot.

I remember when I first started debugging with Shouldly, VS asked me if it should download the source files (.pdb?) of Shouldly to debug with, I think I accidentally told it yes.

If I look at the Modules I have loaded in VS, it shows me this:

enter image description here

It thinks Shouldly is "User Code" which is probably why it debugs into this. How can I disable this?

I have this issue every time I change VS version. I've managed to fix it before but this time I can't figure it out.

Upvotes: 1

Views: 630

Answers (1)

harvzor
harvzor

Reputation: 2908

You can disable symbol loading for a loaded module by:

  1. opening the Module window
  2. searching for the module you want to change
  3. right clicking on it and disabling Always Load Automatically

enter image description here

Upvotes: 0

Related Questions