How can we improve the Windows dev platform?

No user-consent prompt on first run of broadFileSystemAccess-capable UWP app

When running an app which requires broadFileSystemAccess capabilities, no user-consent prompt appears on the first use. Instead, the app crashes with a System.UnauthorizedAccessException. Going into Settings to enable this privacy permission prevents the crash, and the app works normally. However, there is no prompt to enable this permission as described in the docs.

5 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Luke Blevins shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    We are working on it. We are working on updating docs and adding in the prompt like other restricted items.

    A code pattern like this should be a way to catch this scenario.
    {
    StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(@"C:\Foo");
    }
    catch(Exception)
    {
    // prompt user for what action they should do then launch below
    // suggestion could be a message prompt
    await Launcher.LaunchUriAsync(new Uri(“ms-settings:appsfeatures-app”));
    }

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • mobilewares commented  ·   ·  Flag as inappropriate

        .. also on (2) mentioned below - the other weird thing is in the App Settings page, the FileSystem access actually says it's Enabled in settings page. I have to toggle it off and then back on (in which case 1 happens - the App closes).

      • mobilewares commented  ·   ·  Flag as inappropriate

        Hi - the behaviour of this (in 1809) is also a bit strange - have noticed the following when trying to use it here when developing/debugging an App that requires it.

        1) Going into settings for that App and manually enabling the FileSystem Access switch closes the running App immediately. Then if I relaunch the App that setting kicks in.

        2) While I'm working on the app (and debugging it), every few hours (not sure of exact interval) - this previously enabled switch is set to off again and I have to go through above process again to enable it.

        Also the ms-settings launch URI suggested isn't great as it just takes you into Apps & Features rather than the settings page for that specific app (and then you have to find the app etc). Is there a way to navigate directly to the settings page for the App itself?

      Feedback and Knowledge Base