From fa14a911da9b99bbc7ee7c24e2ca614fdae59dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 29 May 2023 18:30:57 +0200 Subject: [PATCH] Fix issue/crash with deployment items and disabled app domains --- .../AssemblyResolver.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs index e01071a0ec..cc5fab95a5 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs @@ -42,6 +42,18 @@ public class AssemblyResolver : MarshalByRefObject, IDisposable /// private const string LoggerAssemblyName = "Microsoft.TestPlatform.CoreUtilities"; + /// + /// The name of the current assembly resources file. + /// + /// + /// When resolving the resources for the current assembly, we need to make sure that we do not log. Otherwise, we will end + /// up either failing or at least printing warning messages to the user about how we could not load the resources dll even + /// when it's not an error. For example, set a culture outside of supported cultures (e.g. en-gb) and you will have an error + /// saying we could not find en-gb resource dll which is normal. For more information, + /// . + /// + private const string PlatformServicesResourcesName = "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources"; + /// /// This will have the list of all directories read from runsettings. /// @@ -587,7 +599,8 @@ private static void SafeLog(string? assemblyName, Action loggerAction) // Logger assembly was in `Microsoft.VisualStudio.TestPlatform.ObjectModel` assembly in legacy versions and we need to omit it as well. if (!StringEx.IsNullOrEmpty(assemblyName) && !assemblyName.StartsWith(LoggerAssemblyName) - && !assemblyName.StartsWith(LoggerAssemblyNameLegacy)) + && !assemblyName.StartsWith(LoggerAssemblyNameLegacy) + && !assemblyName.StartsWith(PlatformServicesResourcesName)) { loggerAction.Invoke(); }