Hi all,
I can't catch the exception when cancel theFileOpenPicker->PickSingleFileAsync operation.
FileOpenPicker^ picker = ref new FileOpenPicker();
picker->FileTypeFilter->Append(".mp4");
picker->SuggestedStartLocation = PickerLocationId::VideosLibrary;
task<StorageFile^> m_pickFileTask(picker->PickSingleFileAsync());
m_pickFileTask.then([this](StorageFile^ files)
{
try
{
x_tb1->Text = "bn3 click" + files->DisplayName->ToString();
}
catch(Platform::Exception^ e)
{
x_tb1->Text = "bn3 exception";
}
catch(...)
{
x_tb1->Text = "bn3 all exception";
}
});
In general,
The x_tb1->Text will same as the file name when I selected by FileOpenPicker
But,
When I doesn't select anyone, and cancel the operation.
The parameter "files" should be null pointer.
So, I want using try-catch to avoid this situation.
The actual result is show a unhandled exception dialog.
It means the try-catch doesn't catch this exception.
Why?
Is there any mistake for my code?
Thanks