Bug 10220 - System.IO.File.Exists has problems if upper/lower case is different
Summary: System.IO.File.Exists has problems if upper/lower case is different
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-02-11 17:18 UTC by tommy
Modified: 2013-02-18 03:26 UTC (History)
1 user (show)

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

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description tommy 2013-02-11 17:18:24 UTC
if i try to manually open a File in a directory the funktions has problems if the upper and lower case between the Filename and the Filename in the code is different (same problem with the extension)

With .NET it works fine.
Comment 1 Mikayla Hutchinson [MSFT] 2013-02-11 17:23:44 UTC
This is because of the filesystem. The filesystem you're using on Linux is case sensitive. Windows filesystems are case insensitive.

You might want to try the MONO_IOMAP environment variable which provides an emulation layer, however you should be aware that the emulation has a performance cost.
Comment 2 tommy 2013-02-13 02:49:30 UTC
thanks for this, my workaround was using Path.GetFileName() and String.Compare() but your solution is much better and should be faster too.
Comment 3 tommy 2013-02-13 03:04:56 UTC
but can someone tell me how to use this in visual Studio?
Comment 4 Mikayla Hutchinson [MSFT] 2013-02-15 14:01:55 UTC
Not sure what you mean, the environment variable has to be set before launching the program (from example in a launch script), and you don't need it set on Windows.
Comment 5 tommy 2013-02-18 03:26:21 UTC
ok thanks, 
i have thought i can set it somewhere in the visual Studio Enviroment or in the start code itself, so that this setting is fixed in my Programm. 

But for now i will use my other solution with Directory.GetFiles(), Path.GetFileName() and String.Compare(). This seems to be the best solution for now.