So I have the following code:
StorageFolder^ storageFolder = ApplicationData::Current->LocalFolder;
concurrency::create_task(storageFolder->GetFileAsync(txtfile)).then([](StorageFile^ sampleFile)
{
concurrency::create_task(FileIO::AppendTextAsync(sampleFile, New_Program_Data)).then([]() {
});
});
Which I use to open a text file and append some data to the end. How can I add exception handling in the event that the file is missing or corrupt or can't be opened?
I've tried various try and catch statements inside and outside the tasks, but nothing seems to work when debugging. The application will break and show an unhandled exception error.