From 29f69aa2d772b9fd09cc557c2fae82fe2bcfdfbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 30 May 2023 09:23:58 +0200 Subject: [PATCH] Fix out of range exception in deployment tool (#1682) --- .../Utilities/DeploymentUtility.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentUtility.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentUtility.cs index da96446d24..69ed5fb893 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentUtility.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentUtility.cs @@ -184,12 +184,9 @@ protected IEnumerable GetSatellites(IEnumerable string satelliteDir = Path.GetDirectoryName(satellite).TrimEnd( new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); - DebugEx.Assert(!StringEx.IsNullOrEmpty(satelliteDir), "DeploymentManager.DoDeployment: got empty satellite dir!"); - DebugEx.Assert(satelliteDir.Length > itemDir.Length + 1, "DeploymentManager.DoDeployment: wrong satellite dir length!"); - - string localeDir = satelliteDir.Substring(itemDir.Length + 1); - DebugEx.Assert(!StringEx.IsNullOrEmpty(localeDir), "DeploymentManager.DoDeployment: got empty dir name for satellite dir!"); - + string localeDir = itemDir.Length > satelliteDir.Length + ? string.Empty + : satelliteDir.Substring(itemDir.Length + 1); string relativeOutputDir = Path.Combine(item.RelativeOutputDirectory, localeDir); // Now finally add the item!