Bug 13664 - IsolatedStorage throws a System.UnauthorizedAccessException
Summary: IsolatedStorage throws a System.UnauthorizedAccessException
Status: CONFIRMED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-07-31 15:33 UTC by Pierce Boggan [MSFT]
Modified: 2013-08-21 11:08 UTC (History)
7 users (show)

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


Attachments

Comment 2 Aaron Bockover [MSFT] 2013-08-07 09:11:20 UTC
The IsolatedStorageFile.GetMachineStoreForXYZ methods throw this exception because the root path for the machine stores resolve to /usr/share/.isolated-storage.

I'm not sure if this is correct, but the concept of machine storage on Mac seems wrong to begin with.

Firstly, machine storage shouldn't use a dot-directory, and the root path should probably be /usr/local/share/mono or /Library/Mono and not /usr/share. /Library/Mono/IsolatedStorage or /usr/local/share/mono/isolated-storage is probably best, and any directories and files created therein should be made world readable/writable I guess (so the same application running under different users can access the files in the same way).
Comment 3 Aaron Bockover [MSFT] 2013-08-07 09:13:25 UTC
Note that similarly on Mac, ~/.config/.isolated-storage is not ideal. It should probably be ~/Library/Mono/IsolatedStorage. I'm not sure why .isolated-storage is a dot directory at all.
Comment 4 Aaron Bockover [MSFT] 2013-08-07 17:41:47 UTC
Conceptually I'm unsure of the "right" thing to do here on Mac. Sharing data across multiple user accounts is a little strange and very technically cumbersome. At best we'd have to instrument the system-Mono installer to set up the right permissions on the Machine Storage directory.

However, the problem can't be fixed for cases where the system-Mono is not used or pre-required (e.g. your application links in and bundles the Mono runtime), since the application itself (run by the user) could not elevate (without lots of extra per-application code) to root/admin privileges to even create and set up the machine storage directory if it were not already set up (and it likely would not be).

I'm thinking maybe for Mac (and probably Linux) we just treat Machine and User storage as the same thing inside the user's home directory.

Apple certainly doesn't want .apps from the store mucking around outside of $HOME or any other further sandboxing (speaking of sandboxing..., effectively hardcoding ~/.config/.isolated-storage [1] is probably a big no-no).

[1] Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData) even resolving to ~/.config is terrible practice on Mac, which is the basis of the root path resolution for IsolatedStorageFile. Other SpecialFolders are similarly bad.
Comment 5 Miguel de Icaza [MSFT] 2013-08-21 11:08:44 UTC
My recommendation is that we fix this as part of our Mobile Profile.

This would ensure that existing apps do not break, and we could add an environment variable or configuration option to go back to the old version.

Note You need to log in before you can comment on or make changes to this bug.