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 compile error when xunit.assert.source package is referenced by a project that also references xunit.core #66

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sdk/Exceptions/CollectionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
using System.Linq;
using Xunit.Internal;

// An "ExceptionUtility" class exists in both xunit.assert (Xunit.Internal.ExceptionUtility) as well as xunit.execution.dotnet (Xunit.Sdk.ExceptionUtility)
// This causes an compile-time error in projects that reference both the xunit.assert.source and xunit.core packages.
// To resolve this issue, add an alias for the Xunit.Internal.ExceptionUtility to make sure, the xunit.assert core uses the right ExceptionUtility
using ExceptionUtilityInternal = Xunit.Internal.ExceptionUtility;

namespace Xunit.Sdk
{
/// <summary>
Expand All @@ -31,7 +36,7 @@ partial class CollectionException : XunitException
static string FormatInnerException(Exception innerException)
{
var text = innerException.Message;
var filteredStack = ExceptionUtility.TransformStackTrace(ExceptionUtility.FilterStackTrace(innerException.StackTrace), " ");
var filteredStack = ExceptionUtilityInternal.TransformStackTrace(ExceptionUtilityInternal.FilterStackTrace(innerException.StackTrace), " ");
if (!string.IsNullOrWhiteSpace(filteredStack))
{
if (text.Length != 0)
Expand Down