Bug 31822 - ObservableCollection.Add() and IsolatedStorageException
Summary: ObservableCollection.Add() and IsolatedStorageException
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.4.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-10 09:20 UTC by Gerald Versluis
Modified: 2016-04-11 06:32 UTC (History)
2 users (show)

Tags: ac
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 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:
Status:
RESOLVED FIXED

Description Gerald Versluis 2015-07-10 09:20:22 UTC
Working on a simple app I retrieve a Json feed and add the entries to an ObservableCollection, nothing fancy, just a for-each loop which adds them to a collection. This works perfectly on Android and iOS.

I have traced it back to when I comment out the ObservableCollection.Add() line, so just get the Json feed in memory, and doing everything else, just not adding them to the list, the exception isn't thrown.

On Windows Phone however I get a IsolatedStorageException: Operation not permitted on IsolatedStorageFileStream.
And I'm not even using any saving! So it must be somewhere in Xamarin code?

Underneath is the full stack-trace. Extra weird is the fact that it only happens when the app is deployed for the first time, on the first run.

Also, it has to do with the fact that it comes through an HttpWebRequest because for the reproduction I tried it from a local file and the error didn't occur.

Also, the default project for the reproduction used Xamarin.Forms.1.3.3.6323, also there the problem there didn't occur.

Reproduction can be found here: https://onedrive.live.com/redir?resid=F34946674FE9E47A!28904&authkey=!ANqZxpF_MIGJe6I&ithint=file%2crar

at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
at Xamarin.Forms.WP8PlatformServices._IsolatedStorageFile.OpenFileAsync(String path, FileMode mode, FileAccess access)
at Xamarin.Forms.UriImageSource.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.UriImageSource.d__1c.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.UriImageSource.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.UriImageSource.d__f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.Platform.WinPhone.ImageLoaderSourceHandler.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Forms.Platform.WinPhone.ImageRenderer.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__3(Object state)
Comment 1 Chris King 2015-07-15 16:58:59 UTC
The repro stopped occurring. Did you change your JSON feed? Now, fewer images are loaded at startup which prevents the issue from recurring.
Comment 2 Gerald Versluis 2015-07-16 03:21:10 UTC
Still reproducible here.

Not be be a wise-ass but did you take note of the 'only at first/fresh installation of the app' remark?

It only works if the app is freshly installed on the emulator. So if you ran it once, deinstall on the emulator and then run again to reproduce.

I've added a screencast to clarify it. What you see is;

1. Uninstall app
2. Run app and see the crash
3. Run app again, working

If I would repeat from step 1, it would crash again.

Screencast:  http://screencast.com/t/QktFDYzZz2Qq
Comment 3 Jason Smith [MSFT] 2016-04-11 06:32:41 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. In particular the entirety of the image loading subsystem has seen a rewrite. If you are still experiencing the issue after updating your packages, please reopen this report.

Warm regards,
Xamarin Forms Team