NotSupportedexception thrown for Isolated storage MVVM Silverlight
I am using Silverlight MVVM and Is开发者_如何学GoolatedStorageSettings.SiteSettings
for session management. Everything is working fine and i am able to read the data in the next page , but design view is giving error as NotSupportedException
.
P.S. : I am storing one single value and bot my view and view model are in different project.
I got the solution at last....
Main reason was that the designer was searching for the Isolated Storage at design time, thats why only the designer was giving the error and other things were working fine. What was needed was to put an if block when declaring and storing isolated storage in the code, this if block will check if the application is in design time.
Hope this help others too...
It is likely that the designer does not provide isolated storage capability, hence the NotSupportedException
that gets raised. To guard against this, you should wrap your isolated storage access in a try/catch, catering for situations where isolated storage is unavailable.
This is something you should be doing as a matter of course when using isolated storage as it is not guaranteed to be available. Users can disable isolated storage for the Silverlight runtime, which will result in IsolatedStorageException
being thrown (see documentation).
精彩评论