The following test passes in 3.13.2, but it fails in 3.13.3:
using System.Collections.Immutable;
using NUnit.Framework;
namespace testimmutabledictionary;
[TestFixture]
public class Class1
{
[Test]
public void TestImmutableDictionary()
{
var numbers = Enumerable.Range(1, 3);
var test1 = numbers.ToImmutableDictionary(t => t);
var test2 = numbers.ToImmutableDictionary(t => t);
Assert.That(test1, Is.SubsetOf(test2));
}
}
Output:
Failed TestImmutableDictionary [54 ms]
Error Message:
Expected: subset of < [1, 1], [2, 2], [3, 3] >
But was: < [1, 1], [2, 2], [3, 3] >
Extra items: < [1, 1], [2, 2], [3, 3] >
Stack Trace:
at testimmutabledictionary.Class1.TestImmutableDictionary() in C:\danl\testimmutabledictionary\Class1.cs:line 16
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 54 ms - testimmutabledictionary.dll (net6.0)
I notice that if both calls are instead ToDictionary, the test passes, but if either one is ToImmmutableDictionary, it fails.
I also noticed that using any of ToImmutableList, ToImmutableArray, or ToImmutableHashSet works (even when paired with non-immutable counterparts), so this seems limited to immutable dictionaries in particular.
project files attached:
testimmutabledictionary.zip
The following test passes in 3.13.2, but it fails in 3.13.3:
Output:
I notice that if both calls are instead
ToDictionary, the test passes, but if either one isToImmmutableDictionary, it fails.I also noticed that using any of
ToImmutableList,ToImmutableArray, orToImmutableHashSetworks (even when paired with non-immutable counterparts), so this seems limited to immutable dictionaries in particular.project files attached:
testimmutabledictionary.zip