Skip to content

Conversation

@mxschmitt
Copy link
Contributor

@mxschmitt mxschmitt commented Nov 22, 2024

ModuleInitializer was something which was not supported in older .NET frameworks. This patch starts listening on the constructor instead and resets the TestOK status in TestInitialize.

Background: xUnit 2 does not provide a reliable way of determining if a test was passing or failing and reading it's status in the AfterEach. xUnit 3 allows to read its status which we'll use once its published. We want to support xUnit 2 as well.

#2977

{
private static readonly ConcurrentStack<Worker> _allWorkers = new();
private Worker? _currentWorker = null!;
private Worker _currentWorker = null!;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: Similar to 7f3b888.

@mxschmitt mxschmitt force-pushed the fix/xunit-support-net462 branch from e3c8e56 to e89982e Compare November 22, 2024 10:23
@kblok
Copy link
Contributor

kblok commented Nov 22, 2024

How about targeting netstandard instead?

@campersau
Copy link
Contributor

xunit.runner.visualstudio and Microsoft.NET.Test.Sdk only work with net462.
Is there a reason why these packages are referenced?

@mxschmitt mxschmitt force-pushed the fix/xunit-support-net462 branch from e89982e to 2d719cc Compare November 22, 2024 13:09
@mxschmitt mxschmitt changed the title fix(net462): support net462 fix(xunit): support netstandard2.0 Nov 22, 2024
@mxschmitt
Copy link
Contributor Author

How about targeting netstandard instead?

I didn't do it because of:

Playwright.Xunit.csproj : warning NU1701: Package 'xunit.runner.visualstudio 2.8.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

Since removing #3063 (comment) sounds good to me we can target netstandard2.0 now.

xunit.runner.visualstudio and Microsoft.NET.Test.Sdk only work with net462. Is there a reason why these packages are referenced?

Addressed.

Thanks both!

@mxschmitt mxschmitt merged commit c9f0914 into main Nov 22, 2024
13 of 15 checks passed
@mxschmitt mxschmitt deleted the fix/xunit-support-net462 branch November 22, 2024 16:18
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

Successfully merging this pull request may close these issues.

5 participants