ApplicationData.ClearAsync() doesn't work in Windows 8.1 Universal App

0

I'm trying to clear the application data when user logout of the application & I found ApplicationData.ClearAsync() which fits my requirement which is similar to IsolatedStorageSettings.ApplicationSettings.Clear() but it gives me an below error

An exception of type 'System.IO.FileLoadException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

I'm not able to understand this as there is no file that I have opened or using as I'm simply using as isolatedstorage just in key value pair.

Kindly help me figure out how I can solve this issue. Thanks in advance

c#-4.0
windows-runtime
win-universal-app
winrt-async

1 Answer

0

It may fail if you have images used in your xaml for instance : is it the case ? One solution I ended up was to clear ApplicationData on the next launch.

You could also list the files and try to delete them one by one.

answered on Stack Overflow Nov 15, 2016 by Jonathan ANTOINE

User contributions licensed under CC BY-SA 3.0