GetFolderAsync applied to the FutureAccessList delivers error message 2148734499
Herbert Stejdir
0
Reputation points
StorageItemAccessList _lAccess = StorageApplicationPermissions.FutureAccessList;
ApplicationDataContainer _localSettings = ApplicationData.Current.LocalSettings;
StorageFolder _Public; // _Public captured by the FolderPicker
StorageFolder _Private; // _Private captured by the FolderPicker
_localSettings.Values [ "Public" ] = _lAccess.Add ( _Public );
_localSettings.Values [ "Private" ] = _lAccessd.Add ( _Private );
private async Task ConnectWorkspace ()
{
_localSettings.Values [ "workspace" ] = null;
try
{
_Public = await _lAccess.GetFolderAsync ( ( string ) _localSettings.Values [ "Public" ] );
await SetPublicWorkspace (); // sets the public usere environment
// sets _localSettings.Values [ "workspace" ] = "public"
}
catch ( Exception ex )
{
_Public = null;
}
try
{
_Private = await _lAccess.GetFoldxerAsync ( ( string ) _localSettings.Values [ "Private ] );
if ( ( string ) _localSettings.Values [ "workspace" ] == "public" )
return;
await SetPrivateWorkSpace (); // sets the private user environment
// sets _localSettings.Values [ "workspace" ] = "private"
}
catch ( Exception ex )
{
_Private = null;
}
}
- What is the purpose: my UWP uses two workspaces, a public and a private one. when a user working in the public workspace and moves outside of the WLAN-reach the UWP shall be capable to detect this and change automatically to the private workspace. In case the user returns within the WLAN-reach the UWP shall automatically change to the the public workspace.
- What I expected: the above code snippet directs the UWP into the appropriate workspace without any interuption of it's normal operation. The realize this, the catch-branch has to be reached in all cases a worspace folder is not reacheable ( because it has been deleted or shifted to another PC )
- What happens: when I e.g. delete the public workspace folder _Public or I shift it to another PC the UWP crashes with error 2148734499 at _LAccess.GetFolderAsync ( .. ) and does'nt reach the catch-branch
- What I did: I made a small UWP with the following functions:
- capture a folder at the first start using FolderPicker and store it in the FutgureAccessList
- at all subsequent starts try to recover the folder from the FutureAccessyList and report errors
- the result was that await_lAccess.GetFolderAsync ( .. ) always delivered the expected result, it either showed me the folder's path or ( reaching the catch-branch ) reported an error I'm helpless, I can't explain the difference in the behaviors.
I.m looking forward to Your help and thank You in advance
Sign in to answer