I get this exceptions when i am trying to create a file inside a folder in sdCard. The folder is created, the file is created, but the text is not written. Someone know why? Because after I will need to access it. This is my code:
StorageFolder myFolder = await KnownFolders.PicturesLibrary.CreateFolderAsync("MarketApp", CreationCollisionOption.ReplaceExisting);
StorageFile myFile = await myFolder.CreateFileAsync("Products.txt", CreationCollisionOption.ReplaceExisting);
Stream f = await myFile.OpenStreamForWriteAsync();
using (StreamWriter sw = new StreamWriter(f))
{
sw.WriteLine("Hello world!");
}
These are the exceptions. They are thrown at the second line.
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll Additional information: Exception has been thrown by the target of an invocation.