24

I am writing some tests using XUnit framework and have to use some external code referenced through a dll.

When I try to step into the method call, helper.GetEntity(), I get the following window and the execution exits.

[Fact]
public void PassingTest()
{
    var datapointJson = File.ReadAllText(@"sample.json");
    dynamic datapointObject = JsonConvert.DeserializeObject(datapointJson);

    // This is referenced from a different project in the same solution.
    var helper = new Helper.Actions();
    var studentEntity = helper.GetEntity("tom");
}

Execution.cs not found

Does anyone know why this is happening?

shA.t
  • 16,580
  • 5
  • 54
  • 111
Codehelp
  • 4,157
  • 9
  • 59
  • 96

2 Answers2

28

(posting @camilo-terevinto's comment as answer)

Turn on 'Enable Just My Code' in Visual Studio | Tools | Debugging | General.

enter image description here

pauldendulk
  • 1,378
  • 12
  • 23
3

So I have been also struggling for 2 days with this one and nothing what I have found online helped me, but the answer of @pauldendulk guided me to the solution. Under Options -> Debbuging -> Just-in-Time I noticed that the "Managed" check box was unmarked and there was an warning label saying something like "multiple debuggers manes code ... please repair Visual Studio to restore ..." (sorry I didn't capture a screen shot and don't remember the right wording, but it was with that context).

After running repair of Visual Studio 2017 (Community Edition) via the "Visual Studio Installer" the test debugging worked like expected.

theCuriousOne
  • 1,022
  • 10
  • 22
  • 1
    Had the same issue with debugging XUnit tests, didn't get the warnings you mention. Running repair of the Visual Studio helped, though. – voidengine May 23 '19 at 12:38