简体   繁体   中英

windows phone 8.1 RT error with files creation

in according to this tutorial: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh758325.aspx?f=255&MSPPError=-2147217396

I've written the following function:

private async void WriteToFile()
{
   StorageFolder folder =
   Windows.Storage.ApplicationData.Current.LocalFolder;
   StorageFile sampleFile =
   await folder.CreateFileAsync("sample.txt", CreationCollisionOption.ReplaceExisting);
}

But, if I run it, I see the following error:

Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
Use of undefined keyword value 1 for event TaskScheduled.

Why? How can I solve this issue?

Its giving error like "Additional information: Use of undefined keyword value 1 for event TaskScheduled" So may be sample.txt can't able to define as its undefined keyword.

Change file name to other name or "sample1.txt", it will work.

private async void WriteToFile()
{
   StorageFolder folder =
   Windows.Storage.ApplicationData.Current.LocalFolder;
   StorageFile sampleFile =
   await folder.CreateFileAsync("sample1.txt", CreationCollisionOption.ReplaceExisting);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM