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

Fix some bugs with the new XunitAssert #13510

Merged
merged 2 commits into from
May 18, 2023
Merged

Conversation

agocke
Copy link
Member

@agocke agocke commented May 13, 2023

I found a few bugs in trying to enable dotnet/runtime#86193. One is that there's no way to flip Arcade to pull in the fork package instead of xunit.assert. The second is that when both are pulled in, because the fork has a different assembly name, the references are ambiguous and produce compile-time breaks. Matching names seems like it will get rid of that problem, and it also has the side-effect of letting the analyzer work properly against the fork.

I found a few bugs in trying to enable dotnet/runtime#86193.
One is that there's no way to flip Arcade to pull in the fork package instead of xunit.assert.
The second is that when both are pulled in, because the fork has a different assembly name, the
references are ambiguous and produce compile-time breaks. Matching names seems like it will get
rid of that problem, and it also has the side-effect of letting the analyzer work properly against
the fork.
ViktorHofer
ViktorHofer previously approved these changes May 15, 2023
@@ -3,7 +3,6 @@

<!-- This project provides xunit.assert, so we can't bring the package in, as it would conflict. -->
<ItemGroup>
<PackageReference Remove="xunit" />
Copy link
Member

@ViktorHofer ViktorHofer May 15, 2023

Choose a reason for hiding this comment

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

Don't you need to set UseDotNetXUnitAssert to true somewhere here for the tests to use the right xunit.assert? But aside, don't you want to use the live reference here and not a PackageReference to Microsoft.DotNet.XUnitAssert?

I guess you now need to PackageReference Remove="xunit.assert" and "Microsoft.DotNet.XUnitAssert" here?

Copy link
Member

Choose a reason for hiding this comment

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

Or do you want rely on conflict resolution here to prefer xunit.assert from Microsoft.DotNet.XUnitAssert over the one coming from the xunit.assert package?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was doing the latter, but the former sounds more reliable. I'll change to doing that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out the test is going to pull from the old version of Arcade (not a live build) so replacing is annoying. I'll rely on conflict resolution for now.

@@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
<Nullable>enable</Nullable>
<!-- Baseline analyzer warnings. These warnings are present in the upstream xunit.assert tests. -->
<NoWarn>$(NoWarn);xUnit2000;xUnit2003;xUnit2005;xUnit2007;xUnit2011;xUnit2015;xUnit2017</NoWarn>
<UseDotNetXUnitAssert>true</UseDotNetXUnitAssert>
Copy link
Member

@ViktorHofer ViktorHofer May 17, 2023

Choose a reason for hiding this comment

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

So with the next Arcade SDK update you will have a PackageReference to Microsoft.DotNet.XUnitAssert and a ProjectReference to the live build. Are you sure that the right version will be picked up? Can you please verify that locally?

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed. The copy of xunit.assert in the test directory is the source-built version.

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.

2 participants