diff --git a/src/ReleaseHistory.md b/src/ReleaseHistory.md index 8727b6b61..025caacc2 100644 --- a/src/ReleaseHistory.md +++ b/src/ReleaseHistory.md @@ -1,6 +1,8 @@ # SARIF Package Release History (SDK, Driver, Converters, and Multitool) ## Unreleased + +* BUGFIX: Fix `ArgumentNullException` when `PropertiesDictionary` is instantiated with a null comparer. [#2482](https://github.com/microsoft/sarif-sdk/pull/2482) * BUGFIX: Fix `UnhandledEngineException` when target path does not exist for multithreaded application by validating directories as is done for singlethreaded analysis. [#2461](https://github.com/microsoft/sarif-sdk/pull/2461) ## **v2.4.14** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.4.14) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.4.14) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.4.14) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.4.14) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/2.4.14) diff --git a/src/Sarif/TypedPropertiesDictionary.cs b/src/Sarif/TypedPropertiesDictionary.cs index 344c2a4c0..964761a3f 100644 --- a/src/Sarif/TypedPropertiesDictionary.cs +++ b/src/Sarif/TypedPropertiesDictionary.cs @@ -19,7 +19,7 @@ public TypedPropertiesDictionary() : this(null, StringComparer.Ordinal) { } - public TypedPropertiesDictionary(PropertiesDictionary initializer, IEqualityComparer comparer) : base(comparer) + public TypedPropertiesDictionary(PropertiesDictionary initializer, IEqualityComparer comparer) : base(comparer ?? StringComparer.Ordinal) { if (initializer != null) { diff --git a/src/Test.UnitTests.Sarif.WorkItems/Test.UnitTests.Sarif.WorkItems.csproj b/src/Test.UnitTests.Sarif.WorkItems/Test.UnitTests.Sarif.WorkItems.csproj index 735d42194..25539bf41 100644 --- a/src/Test.UnitTests.Sarif.WorkItems/Test.UnitTests.Sarif.WorkItems.csproj +++ b/src/Test.UnitTests.Sarif.WorkItems/Test.UnitTests.Sarif.WorkItems.csproj @@ -9,6 +9,7 @@ netcoreapp3.1 + $(TargetFrameworks);net48 false true Test.UnitTests.Sarif.WorkItems diff --git a/src/Test.UnitTests.Sarif/PropertiesDictionaryTests.cs b/src/Test.UnitTests.Sarif/PropertiesDictionaryTests.cs index 241fbc29d..6d58afc04 100644 --- a/src/Test.UnitTests.Sarif/PropertiesDictionaryTests.cs +++ b/src/Test.UnitTests.Sarif/PropertiesDictionaryTests.cs @@ -172,6 +172,24 @@ public void PropertiesDictionary_TestCacheDescription() PropertiesDictionary_TestCacheDescription_Helper(GeneratePropertiesDictionaryProperty, PROPERTIES_NONDEFAULT); } + [Fact] + public void PropertiesDictionary_ShouldNotThrownException_WhenComparerIsNull() + { + var initializer = new PropertiesDictionary(); + + Exception exception = Record.Exception(() => + { + new PropertiesDictionary(initializer); + }); + exception.Should().BeNull(); + + exception = Record.Exception(() => + { + new PropertiesDictionary(initializer, comparer: null); + }); + exception.Should().BeNull(); + } + private void PropertiesDictionary_TestCacheDescription_Helper(Func GeneratePropertyMethod, object value) { string textLoaded = string.Empty; diff --git a/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj b/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj index fdabcaa80..4f6b691c0 100644 --- a/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj +++ b/src/Test.UnitTests.WorkItems/Test.UnitTests.WorkItems.csproj @@ -10,6 +10,7 @@ netcoreapp3.1 + $(TargetFrameworks);net48 false true