FileLoadException for NUnit 4.2.2 when upgrade the System.Buffers to 4.6.0 #4887
Description
I have a test csproj based on net472
, its package reference is following:
<ItemGroup>
<PackageReference Include="JetBrains.dotMemoryUnit" Version="3.2.20220510" />
<PackageReference Include="MathNet.Spatial" Version="0.6.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
and the unit tests runs OK
9 days ago, the System.Buffers
published the 4.6.0
package, so I try it, then the test csproj's package reference changed to:
<ItemGroup>
<PackageReference Include="JetBrains.dotMemoryUnit" Version="3.2.20220510" />
<PackageReference Include="MathNet.Spatial" Version="0.6.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="System.Buffers" Version="4.6.0" />
</ItemGroup>
Actully, I just append the System.Buffers 4.6.0
package, the test csproj failled many test cases, all get a FileLoadException
, detail manage is following:
System.IO.FileLoadException : Could not load file or assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at NUnit.Framework.Constraints.Comparers.StreamsComparer.Equal(Object x, Object y, Tolerance& tolerance, ComparisonState state, NUnitEqualityComparer equalityComparer)
at NUnit.Framework.Constraints.NUnitEqualityComparer.AreEqual(Object x, Object y, Tolerance& tolerance, ComparisonState state)
at NUnit.Framework.Constraints.NUnitEqualityComparer.AreEqual(Object x, Object y, Tolerance& tolerance)
at NUnit.Framework.Constraints.CollectionTally.TryRemove(Object o)
at NUnit.Framework.Constraints.CollectionTally.<TryRemove>g__TryRemoveSlow|11_0(IEnumerable c)
at NUnit.Framework.Constraints.CollectionEquivalentConstraint.Matches(IEnumerable actual, CollectionTallyResult& tallyResult)
at NUnit.Framework.Constraints.CollectionEquivalentConstraint.ApplyTo[TActual](TActual actual)
at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression, NUnitString message, String actualExpression, String constraintExpression)
at RanplanWireless.Terrain.Tests.RasterExtentTests.GivenBasic2x2Extent_WhenEnumerateRasterBorderCoordinates_ThenBorderReturned() in E:\workGit\iBuildNet_UK2\iBuilding\RanplanWireless.Terrain.Tests\RasterExtentTests.cs:line 139
When I downgrade the NUnit
to 4.1.0
and keep the System.Buffers 4.6.0
, the test csproj also runs OK
NUnitDemo.zip Here has a demo project, when remove the statement <PackageReference Include="System.Buffers" Version="4.6.0" />
from the NUnitDemo.csproj
, the test will runs OK, but if the System.Buffers
package reference exist, the test will be fail.
Please investigate and double-check it, thanks