nunit3-vs-adapter: Exception in OneTimeSetUp has no stack trace
When an exception is thrown in code called from a OneTimeSetUp method, I get:
Exception doesn’t have a stacktrace
Code to demonstrate the problem:
public class Tests
{
[OneTimeSetUp]
public void Setup()
{
throw new Exception("oops");
}
[Test]
public void Test1()
{
Assert.Pass();
}
}
Versions:
- .NET Core 3.0
- NUnit 3.12.0
- NUnit3TestAdapter 3.15.1
- Microsoft.NET.Test.SDK 16.3.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 25 (12 by maintainers)
Commits related to this issue
- Fix for issue #671, exception stacktrace from OneTimeSetup — committed to nunit/nunit3-vs-adapter by OsirisTerje 3 years ago
- Merge pull request #864 from nunit/Issue671 Fix for issue #671, exception stacktrace from OneTimeSetup — committed to nunit/nunit3-vs-adapter by OsirisTerje 3 years ago
Please reconsider, this is HUGE waste of time. Think about CI scenario, sometimes setup is pretty complex and when it went wrong all you get is NullReferenceException.
FYI, you can sort-of bypass this issue, by wrapping all of your
OneTimeSetUpmethods in:Kinda sucks, but it’s better than what you get at the moment.
Nice, any progress on this? I’m sure the people over at this issue would appreciate this.
Transferred!
@OsirisTerje I realize you may have other issues that relate to this one, but I transferred it in case it has added useful info.