From c903ddb42af639aa43656b65f3ad6c1da1c9b541 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 9 Jan 2025 22:14:16 +1100 Subject: [PATCH] fix param nullability in IsAssemblyReferenced --- .../PublicAPI/net462/PublicAPI.Unshipped.txt | 1 + .../MSTestAdapter.PlatformServices/Services/TestSource.cs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/PublicAPI/net462/PublicAPI.Unshipped.txt b/src/Adapter/MSTestAdapter.PlatformServices/PublicAPI/net462/PublicAPI.Unshipped.txt index 7dc5c58110..6745e0109b 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/PublicAPI/net462/PublicAPI.Unshipped.txt +++ b/src/Adapter/MSTestAdapter.PlatformServices/PublicAPI/net462/PublicAPI.Unshipped.txt @@ -1 +1,2 @@ #nullable enable +Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestSource.IsAssemblyReferenced(System.Reflection.AssemblyName? assemblyName, string? source) -> bool diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs index e24f91db0a..a672870f75 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs @@ -79,11 +79,12 @@ public class TestSource : ITestSource /// The assembly name. /// The source. /// True if the assembly is referenced. - public bool IsAssemblyReferenced(AssemblyName assemblyName, string source) + public bool IsAssemblyReferenced(AssemblyName? assemblyName, string? source) { #if NETFRAMEWORK // This loads the dll in a different app domain. We can optimize this to load in the current domain since this code could be run in a new app domain anyway. - bool? utfReference = AssemblyHelper.DoesReferencesAssembly(source, assemblyName); + // suppress null on DoesReferencesAssembly since it does actually allow nulls + bool? utfReference = AssemblyHelper.DoesReferencesAssembly(source!, assemblyName!); // If no reference to UTF don't run discovery. Take conservative approach. If not able to find proceed with discovery. return !utfReference.HasValue || utfReference.Value;