Skip to content

Commit 38af2b8

Browse files
authored
Fix System.Configuration.ConfigurationManager.Tests on Android and reenable on non-Windows platforms (#56558)
The test assembly got changed to `$(NetCoreAppCurrent)-windows` in 809a06f#diff-4d639cb37fe53cdeae4262c1f5be7936cdd81e3b4f256f9c59ad02ec69b300d9R7 but when talking to Viktor we're not sure why, probably a mistake. Target `$(NetCoreAppCurrent)` instead so it runs on all platforms and fix a test issue that occurs on Android due to BaseDirectory not having a trailing slash. Fixes #37071 Incidentally, that's likely also the reason why the .csproj set `TestDisableAppDomain` so we can remove that as well. Also replace `TestDisableParallelization` with the assembly attribute equivalent which is what we use everywhere else.
1 parent cb64fe6 commit 38af2b8

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/libraries/System.Configuration.ConfigurationManager/tests/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
using System;
55
using Xunit;
66

7+
[assembly: CollectionBehavior(DisableTestParallelization = true, MaxParallelThreads = 1)]
8+
79
[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Configuration.ConfigurationManager is not supported on Browser")]

src/libraries/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<!-- XUnit AppDomains BaseDirectory path doesn't contain a trailing slash, which impacts our tests. -->
4-
<TestDisableAppDomain>true</TestDisableAppDomain>
5-
<TestDisableParallelization>true</TestDisableParallelization>
63
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
7-
<TargetFrameworks>$(NetCoreAppCurrent)-windows;net461</TargetFrameworks>
4+
<TargetFrameworks>$(NetCoreAppCurrent);net461</TargetFrameworks>
85
<IgnoreForCI Condition="'$(TargetOS)' == 'Browser'">true</IgnoreForCI>
96
</PropertyGroup>
107
<ItemGroup>

src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/UrlPathTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public void GetDirectoryOrRootName_GettingDirectoryFromAFilePath()
3131
// Remove the trailing slash. Different OS's use a different slash.
3232
// This is to make the test pass without worrying about adding a slash
3333
// and which kind of slash.
34-
string exePathWithoutTrailingSlash = exePath.Substring(0, exePath.Length - 1);
35-
string pathToNonexistentFile = exePath + "TestFileForUrlPathTests.txt";
34+
string exePathWithoutTrailingSlash = exePath.TrimEnd(Path.DirectorySeparatorChar);
35+
string pathToNonexistentFile = Path.Combine(exePath, "TestFileForUrlPathTests.txt");
3636

3737
string test = UrlPath.GetDirectoryOrRootName(pathToNonexistentFile);
3838
Assert.Equal(exePathWithoutTrailingSlash, test);

0 commit comments

Comments
 (0)