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 for Bug 41258 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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 16073 [details]
Version info provided by Xamarin Studio
var myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
will return the same as if called with Environment.SpecialFolder.UserProfile on OS X
So "/Users/username", instead of "/Users/username/Documents" (on a mac with language EN)
The code in question is here:
This is by design.
Unfortunately SpecialFolder.Personal has same value as SpecialFolder.MyDocuments so we cannot easily distinguish between them hence we return /Users/username which sort of fits to both of them.
A workaround then. The link below is for iOS, but it worked for me on OS X 10.10 as well:
And the code based on the link which makes it:
var myDocumentsDir = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User).Path;
Norbert is correct. We are treating Personal and MyDocument the same as UserProfile.
From the RS definition of SpecialFolder:
UserProfile = Win32Native.CSIDL_PROFILE
Personal = Win32Native.CSIDL_PERSONAL
MyDocuments = Win32Native.CSIDL_PERSONAL
And if we look at the CSIDL definitions:
CSIDL_PROFILE: The user's profile folder. A typical path is C:\Users\username.
CSIDL_PERSONAL: The virtual folder that represents the My Documents desktop item. This is equivalent to CSIDL_MYDOCUMENTS. A typical path is C:\Documents and Settings\username\My Documents.
So yes, Personal and MyDocuments are the same, but we've been treating Personal as UserProfile, which is a bug in Mono on Mac.
So on a Mac it should be (and if not the paths below, whatever blessed NSFileManager API makes sense, as Norbert points out):
UserProfile → $HOME
Personal → $HOME/Documents
MyDocuments → $HOME/Documents
We could try to change Personal/MyDocuments case with some fall-back option to old behaviour