Bug 368 - IsolatedStorageFile.GetFileNames raises SecurityException when 0 files in path
Summary: IsolatedStorageFile.GetFileNames raises SecurityException when 0 files in path
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 1.0
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: mono-android@xamarin.com
Depends on:
Reported: 2011-08-23 15:02 UTC by Brett
Modified: 2013-12-05 18:34 UTC (History)
4 users (show)

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

proof of concept app that verifies it works (7.31 KB, application/x-bzip)
2011-10-04 13:30 UTC, Atsushi Eno

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 Developer Community or GitHub 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 Brett 2011-08-23 15:02:41 UTC
This is what I'm experiencing:

Get an instance of IsolatedStorageFile with GetUserStoreForAssembly()

Create the directory with CreateDirectory(string)

Verify it got created with DirectoryExists(string)


At a later time try to get the files in the store with GetFileNames(), if the path provided is empty a SecurityException is thrown.
Comment 1 Atsushi Eno 2011-10-04 13:30:24 UTC
Created attachment 588 [details]
proof of concept app that verifies it works
Comment 2 Atsushi Eno 2011-10-04 13:30:52 UTC
I cannot reproduce this. It is possible that your device has problem on manipulating file systems (I encountered such problems while I tried some cheap tablets).

I attached a test case that verifies it *does* work. Here is the OnCreate() part :

		protected override void OnCreate (Bundle bundle)
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button> (Resource.Id.myButton);
			button.Click += delegate {
				if (IsolatedStorageFile.GetUserStoreForAssembly().GetFileNames ().Length == 0)
					button.Text = "empty";
					button.Text = "not empty";
			var fs = IsolatedStorageFile.GetUserStoreForAssembly();
			fs.CreateDirectory ("testdir");

If you still have some isolated storage issue, please attach a proof of concept test case that we can verify.
Comment 3 Nicklas Petersson 2012-01-03 10:06:24 UTC
I had the same issue, when using for example GetFileNames("myrootFolder/*.*") 

After trial and error i replaced the forward-slashes with backward-slashes and then it worked (the System.IO.Path.PathSeparator is a forward-slash, but does not work with IsolatedStorage on Android)

/Nicklas Petersson
Comment 4 PJ 2013-11-19 17:04:26 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 5 PJ 2013-12-05 18:34:29 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.