Search code examples
c#visual-studio-2019xunit.net-5

Cannot debug an xUnit Theory case


So I have an xUnit project running on VS 2019. The specs are as follows:

  • VS2019 (16.9.3)
  • xUnit 2.4.1
  • xUnit.runner.visualstudio 2.4.3
  • FluentAssertions 5.10.3
  • Microsoft.NET.Test.Sdk 16.9.4

I have a simple test case in the xUnit project which looks as follows:

    [Theory]
    [InlineData("Hello", "World")]
    public void ShouldGreetEntity(string greeting, string entityname)
    {
        var expected = $"{greeting} {entityname}";

        var returned = $"{greeting} {entityname}";

        returned.Should().Be(expected);
    }

Ignore the sensibility of the test case.

I have no issues with running the test case. It runs and give me passed result. However, upon trying to debug this test case, it pops up a tab prompting me to locate a 'TestClass.cs' file. It looks as follows:

enter image description here

Does anyone have any idea what this is about?


Solution

  • As suggested by @canton7, after reviewing the 'Call Stack' and 'Breakpoint' windows, I found there was a breakpoint on a non-existent file called 'TestClass.cs'. Deleting all breakpoints fixed this issue.