Skip to content

Commit b092091

Browse files
authored
Enable System.IO.FileSystem tests for native aot (#76146)
1 parent f9319be commit b092091

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/libraries/System.IO.FileSystem/tests/FileStream/FileStreamConformanceTests.Windows.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,23 @@ public class UncFilePathFileStreamStandaloneConformanceTests : UnbufferedAsyncFi
8585

8686
private static Lazy<bool> _canShareFiles = new Lazy<bool>(() =>
8787
{
88-
if (!PlatformDetection.IsWindowsAndElevated || PlatformDetection.IsWindowsNanoServer)
88+
if (!PlatformDetection.IsWindowsAndElevated)
8989
{
9090
return false;
9191
}
9292

93-
// the "Server Service" allows for file sharing. It can be disabled on some of our CI machines.
94-
using (ServiceController sharingService = new ServiceController("Server"))
93+
try
94+
{
95+
// the "Server Service" allows for file sharing. It can be disabled on some machines.
96+
using (ServiceController sharingService = new ServiceController("Server"))
97+
{
98+
return sharingService.Status == ServiceControllerStatus.Running;
99+
}
100+
}
101+
catch (InvalidOperationException)
95102
{
96-
return sharingService.Status == ServiceControllerStatus.Running;
103+
// The service is not installed.
104+
return false;
97105
}
98106
});
99107

src/libraries/tests.proj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,6 @@
485485
<!-- More than two thirds of tests failing due to ref emit -->
486486
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.DependencyInjection\tests\DI.Tests\Microsoft.Extensions.DependencyInjection.Tests.csproj" />
487487

488-
<!--This test fails on Windows.10.Amd64.Server2022 -->
489-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj" />
490488
<!--Needs work to get these tests to pass -->
491489
<!--These tests have failures-->
492490
<!-- Looks like our xunit runner doesn't respect tests that don't want to be multithreaded -->

0 commit comments

Comments
 (0)