Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 25370 [details]
The test program
The bug appears when you try to verify the existence of a file in a directory, that is a symlink. The symlink may not point to a directory higher in the directory structure, it has to be on another branch. Moreover, you have to use ".." in a path, just after pointing to the directory in question
Steps to reproduce:
1) in the exe directory create the following directory structure:
-> test3 -> test/test2 (test3 is a symlink to test/test2 dir. This structure is crucial)
2) run the attached code.
It checks the existence of "test3/../test3/" directory.
Directory.Exists fails, but Directory.GetFileSystemEntries works (prints the "test_file").
The same code DOES work on another directory structure:
-> test2 -> test (test2 is a symlink to test dir)
Directory.Exists should understand symlinks, and handling of different directory structures should be consistent.
I can reproduce with Mono 184.108.40.206 (2017-10/ce494e3d152)
To reproduce, run following commands:
> mkdir test
> mkdir test/test2
> touch test/test2/test_file
> ln -s test/test2 test3
> csc repro.cs && mono repro.exe
It seems that the lstat() syscall itself does not like that path. The solution may have to be part of mono_portability_find_file_internal()
Directory.Exists does work as expected under .NET Core 2.0.
Candidate fix at https://github.com/mono/mono/pull/6039
Fix merged to master