Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITestRunner.Run() does not pass Activity.Current to underlying test #1591

Open
DanielVuurboom opened this issue Jan 3, 2025 · 2 comments
Open

Comments

@DanielVuurboom
Copy link

We're calling specific tests programmatically through ITestRunner.Run(). In older versions of NUnit.Engine, the Activity.Current that was started before the Run() call was available in the test, and we use this to pass some data (a TraceId, to be specific).
In the current version, Activity.Current is set to null inside the test, which breaks our implementations.

Please see the attached zip file for a small C# project demonstrating the current, unexpected, behavior:
ActivityDebugging.zip

Replacing the packages with these older versions shows the Activity.Current set as expected:

    <PackageReference Include="NUnit.Engine" Version="3.15.2" />
    <PackageReference Include="NUnit.Engine.Api" Version="3.15.2" />
    <PackageReference Include="NUnit" Version="3.13.3" />
@CharliePoole
Copy link
Member

What happens if you use the 3.19 engine and api but vary the version of NUnit?

@DanielVuurboom
Copy link
Author

DanielVuurboom commented Jan 6, 2025

    <PackageReference Include="NUnit.Engine" Version="3.19.0" />
    <PackageReference Include="NUnit.Engine.Api" Version="3.19.0" />
    <PackageReference Include="NUnit" Version="3.13.3" />

results in a null Activity.Current, just like

    <PackageReference Include="NUnit.Engine" Version="3.19.0" />
    <PackageReference Include="NUnit.Engine.Api" Version="3.19.0" />
    <PackageReference Include="NUnit" Version="4.3.2" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants