Change PathInternal.IsCaseSensitive to a constant (#54340)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 23 Jun 2021 13:44:41 +0000 (09:44 -0400)
committerGitHub <noreply@github.com>
Wed, 23 Jun 2021 13:44:41 +0000 (09:44 -0400)
commitc0ed319ba3164bfbd9c2c4d66f68f29f8cd78b04
treebb9c6b3d44d0b055aba1680b2c42fca84bae9517
parentfa86c81b61b10daf3da4438b894a7d4405e229e8
Change PathInternal.IsCaseSensitive to a constant (#54340)

* Return constants in PathInternal.GetIsCaseSensitive() on mobile platforms

   In particular on Android probing using I/O is slow and contributes to slow app startup.

   Fixes https://github.com/dotnet/runtime/issues/54339

* Implement Path.IsCaseSensitive as PathInternal.IsCaseSensitive

   Also Path.StringComparison => PathInternal.StringComparison

* Add test for PathInternal.IsCaseSensitive

   Move GetIsCaseSensitiveByProbing to FileSystemTest

* Drop PathInternal.s_isCaseSensitive cache field

* Delete Path.IsCaseSensitive and Path.StringComparison

   update callers to use PathInternal.IsCaseSensitive and PathInternal.StringComparison

* Remove catch clause from GetIsCaseSensitiveByProbing

* Mark new test [OuterLoop]

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
src/libraries/Common/src/System/IO/PathInternal.CaseSensitivity.cs
src/libraries/System.IO.FileSystem/tests/FileSystemTest.cs
src/libraries/System.IO.FileSystem/tests/Net5CompatTests/System.IO.FileSystem.Net5Compat.Tests.csproj
src/libraries/System.IO.FileSystem/tests/PathInternalTests.cs [new file with mode: 0644]
src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs
src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs
src/libraries/System.Private.CoreLib/src/System/IO/Path.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs