Bug 28875 - System.IO.Directory.EnumerateFiles on Mac is case-sensitive
Summary: System.IO.Directory.EnumerateFiles on Mac is case-sensitive
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Ludovic Henry
Depends on:
Reported: 2015-04-07 22:17 UTC by xamarin
Modified: 2018-04-05 21:53 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

bug28875.zip (258.01 KB, application/zip)
2018-04-05 21:53 UTC, Ludovic Henry

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 28875 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description xamarin 2015-04-07 22:17:32 UTC
It appears that on Mac, Directory.EnumerateFiles, when called with a search pattern, behaves in a case-sensitive manner. Deep in the bowels of the Mono sources on github, it seems this may be controlled via a #define of IS_PORTABILITY_CASE and others.

As a workaround, list everything w/o a search pattern and filter yourself, if you care to have a case insensitive search occur.
Comment 1 xamarin 2015-04-07 22:18:14 UTC
Seems this has also been mentioned here:

Comment 2 Marek Safar 2015-04-15 07:50:09 UTC
It looks like IS_PORTABILITY_CASE is not initialised correctly. We'll probably have to read some HFS+ as it can be both case sensitive and insensitive.

The easiest workaround for you is to set MONO_IOMAP=case
Comment 3 Ludovic Henry 2018-04-05 21:53:09 UTC
Created attachment 26244 [details]

I can reproduce with Mono (master/df33c092de3) on an case-insensitive APFS volume.

The workaround provided in https://bugzilla.xamarin.com/show_bug.cgi?id=28875#c2 do gives the expected behavior.