Picking image from picture folder - "The drive cannot locate a specific area or track on the disk."

0

I am making an UWP app in C# where the user can choose to take a picture or use an exisiting one. The image picker is opened with this code

            FileOpenPicker picker = new FileOpenPicker();
            picker.SuggestedStartLocation =    PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");
            StorageFile file = await picker.PickSingleFileAsync();

On a physical device I get this exception:

Exception thrown: 'System.Exception' in mscorlib.ni.dll
The drive cannot locate a specific area or track on the disk. (Exception from HRESULT: 0x80070019)

The weird thing is that I don't get an exception on any of the emulators and it used to work on the physical device too. Any suggestions or explanations?

c#
image
mobile
camera
uwp
asked on Stack Overflow Nov 2, 2015 by stonecompass • edited Nov 3, 2015 by stonecompass

2 Answers

1
1

You might want to check your Properties\WMAppManifest.xml file. Make sure that the matadata there is correct. For example, check if the Type attribute is correct ("badabumm.ScheduledAgent" in the example below).

<Tasks>      
    <DefaultTask Name="_default" NavigationPage="badabumm.xaml" />
    <ExtendedTask Name="BackgroundTask">
            <BackgroundServiceAgent Specifier="ScheduledTaskAgent" Name="badabumm Agent" Source="badabumm Agent" Type="badabumm.ScheduledAgent" />
    </ExtendedTask>
</Tasks>

This solution was originally proposed in this source.

answered on Stack Overflow Nov 20, 2015 by Amadeus Sánchez

User contributions licensed under CC BY-SA 3.0