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

Compile error when referencing both xunit.core and xunit.assert.source #2889

Closed
ap0llo opened this issue Feb 16, 2024 · 3 comments · Fixed by xunit/assert.xunit#66
Closed

Comments

@ap0llo
Copy link
Contributor

ap0llo commented Feb 16, 2024

Since xunit 2.7.0, there is a compile error if a project uses both the xunit.core and xunit.assert.source packages:

[...]\packages\xunit.assert.source\2.7.0\contentFiles\cs\netstandard1.1\Asserts\Sdk\Exceptions\CollectionException.cs(34,41): error CS0117: 'ExceptionUtility' does not contain a definition for 'TransformStackTrace' [...]
[...]\packages\xunit.assert.source\2.7.0\contentFiles\cs\netstandard1.1\Asserts\Sdk\Exceptions\CollectionException.cs(34,78): error CS0117: 'ExceptionUtility' does not contain a definition for 'FilterStackTrace' [...]

This is due to the fact that an "ExceptionUtility" class exists in both the xunit.assert.source (Xunit.Internal.ExceptionUtility) and the xunit.execution.dotnet (Xunit.Sdk.ExceptionUtility) packages.

You can find a repro showing this issue here: https://github.com/ap0llo/repro-xunit-2-7-compile-error/

I've prepared a fix for this here: https://github.com/xunit/assert.xunit/pull/66/files

ap0llo added a commit to ap0llo/assert.xunit that referenced this issue Feb 16, 2024
… project that also references xunit.core

Fix ambiguous reference to type "ExceptionUtility" that ocurred when a project references both the xunit.assert.source and xunit.core packages.
To avoid compile-errors, add type alias to make sure the source code in xunit.assert always uses XUnit.Internal.ExceptionUtility.

Fixes xunit/xunit#2889
@sensslen
Copy link

sensslen commented Apr 4, 2024

Any chance to get a release soon?

@bradwilson
Copy link
Member

I don't have a release planned at the moment, so I can't give you a firm date. You can either roll xunit.assert.source back to 2.6.6 or use a CI build in the interim: https://xunit.net/docs/using-ci-builds

@bradwilson
Copy link
Member

@sensslen FYI, I'm shipping a release for this later today which will be versioned as 2.7.1.

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