Skip to content
This repository was archived by the owner on Nov 27, 2017. It is now read-only.

Stack trace has no source links #60

Open
BalassaMarton opened this issue Jul 24, 2016 · 9 comments
Open

Stack trace has no source links #60

BalassaMarton opened this issue Jul 24, 2016 · 9 comments

Comments

@BalassaMarton
Copy link

BalassaMarton commented Jul 24, 2016

This works with the classic .NET Framework version as expected: when a test fails, the stack trace contains clickable links to specific source code locations. However, when running tests on a .NET Core test project, there are no links, only string descriptions of the location of the error.

Steps to reproduce

  1. Create Class Library (.NET Core) project containing a single class Class1:
    public class Class1
    {
        public void Batman()
        {
            throw new Exception("Batman failed");
        }
    }
  1. Create another class library with test class TestClass1:
    [TestFixture]
    public class TestClass1
    {
        [Test]
        public void Test1()
        {
            var obj = new Class1();
            obj.Batman();
            Assert.True(true);
        }
    }
  1. Run or debug the test. The test will fail, but the stack trace is not clickable.

image

@rprouse
Copy link
Member

rprouse commented Jul 29, 2016

Thanks for the detailed report. We will need to confirm that this is an NUnit issue and not a Visual Studio issue. I am pretty sure it is the later since the code for both is the same.

@BalassaMarton
Copy link
Author

The weirdest thing is that the link works when the exception is at the top of the stack (eg. an assertion failed).

@rprouse
Copy link
Member

rprouse commented Jul 29, 2016

One way that we will be able to confirm if this is an NUnit or Visual Studio issue is to try it using xUnit or MSTests.

@jcansdale
Copy link
Contributor

@rprouse Have you ever managed to get 'dotnet-test-mstest' working? It seems to be broken whenever I've tried it. I just assumed they haven't updated it yet for .NET Core 1.0.

@BalassaMarton
Copy link
Author

@rprouse I've repeated the steps with Xunit and the stack trace links are working. I believe it is a NUnit-related issue.

@CharliePoole
Copy link
Member

NUnit provides a raw stack trace coming from .NET. It isn't reformatted to be clickable. That would be the job of the gui component that formats it for display. I assume that's the adapter in this case.

@jcansdale
Copy link
Contributor

@BalassaMarton Could you try running the same test using TestDriven.Net. Right-click and 'Run Test(s)' inside the test method and double-click on the stack trace in the output window. You can find a preview build here:
jcansdale/TestDriven.Net-Issues#21 (comment)

As @CharliePoole mentions, it's tools that reformat the message to make them clickable or add hyperlinks. They will expect the stacktrace to be in the default format.

Let me know if this works.

rprouse added a commit to rprouse/NetCoreTests that referenced this issue Nov 1, 2016
@rprouse
Copy link
Member

rprouse commented Nov 1, 2016

I have confirmed this to be the case in the NUnit .NET Core runner. It does not happen in MSTest or in xUnit. The .NET Core runner works correctly if the exception is thrown in the test method, just not in a called method.

@rprouse
Copy link
Member

rprouse commented Nov 1, 2016

I have also confirmed that this works in the full framework NUnit Adapter, so it is definately a .NET Core Adapter issue.

rprouse added a commit to rprouse/nunit-tests that referenced this issue Nov 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants