Skip to content

Issue with System.IO.GetIsCaseSensitive #54313

@BruceForstall

Description

@BruceForstall

I was running a crossgen2 of System.Private.CoreLib.dll (actually a SuperPMI collection of that), and getting a failure. I put it under the VS debugger and got something completely different, namely:

Process terminated. Assertion failed.
Casing test failed: System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\CASESENSITIVETEST3e2cf88a10694adbaeb85ab4ec42540f' is denied.
   at System.IO.Strategies.FileStreamHelpers.ValidateFileHandle(SafeFileHandle fileHandle, String path, Boolean useAsyncIO) in System.Private.CoreLib.dll:token 0x6005d7a+0x27
   at System.IO.Strategies.FileStreamHelpers.CreateFileOpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in System.Private.CoreLib.dll:token 0x6005d74+0x83
   at System.IO.Strategies.WindowsFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) in System.Private.CoreLib.dll:token 0x6005e36+0x23
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) in System.Private.CoreLib.dll:token 0x6005d71+0x28
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) in System.Private.CoreLib.dll:token 0x60059dc+0x10e
   at System.IO.PathInternal.GetIsCaseSensitive() in System.Private.CoreLib.dll:token 0x6005ace+0x27
   at System.IO.PathInternal.GetIsCaseSensitive() in System.Private.CoreLib.dll:token 0x6005ace+0x27
   at System.IO.PathInternal..cctor() in System.Private.CoreLib.dll:token 0x6005adb+0x0
   at System.IO.Enumeration.FileSystemEnumerableFactory.MatchesPattern(String expression, ReadOnlySpan`1 name, EnumerationOptions options) in System.Private.CoreLib.dll:token 0x6005e92+0x0
   at System.IO.Enumeration.FileSystemEnumerableFactory.<>c__DisplayClass3_0.<UserFiles>b__1(FileSystemEntry& entry) in System.Private.CoreLib.dll:token 0x6005e9b+0x8
   at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext() in System.Private.CoreLib.dll:token 0x6005e79+0x0
   at Internal.CommandLine.Helpers.AppendExpandedPaths(Dictionary`2 dictionary, String pattern, Boolean strict) in crossgen2.dll:token 0x600011a+0x8c
   at ILCompiler.Program.ProcessCommandLine(String[] args) in crossgen2.dll:token 0x6000156+0x129
   at ILCompiler.Program.Run(String[] args) in crossgen2.dll:token 0x6000159+0x6
   at ILCompiler.Program.Main(String[] args) in crossgen2.dll:token 0x6000161+0x5

This comes from

Debug.Fail("Casing test failed: " + exc);

The issue is that my debugging environment didn't include TEMP (you can see above it's using "C:\WINDOWS" as the "temp" directory). When I added "TEMP=C:\Users\brucefo\AppData\Local\Temp" to my environment, it worked fine.

Question: Should this "Debug.Fail" exist? The comment says:

                // In case something goes terribly wrong, we don't want to fail just because
                // of a casing test, so we assume case-insensitive-but-preserving.

so should it just "move on" without this fatal error?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions