我想使用 StorageFile 来实现读取和写入,如下所示
http://msdn.microsoft.com/en-us/library/windows/apps/hh758325.aspx#writing_to_a_file
与
public async void Save()
{
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile sampleFile = await storageFolder.CreateFileAsync(PlayerPrefs.GetString("WorldName") +"_"+filename);
await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow");
}
但是“await”行给出了异常
+ $exception {Cannot evaluate expression because a native frame is on top of the call stack.} System.Exception {System.UnauthorizedAccessException}
如果这有任何不同,我将 Unity 与 Windows 8 应用商店一起使用。
有人知道这里的问题是什么吗?
最佳答案
Cannot evaluate expression because a native frame is on top of the call stack
这只告诉我们线程正在执行 unmanaged code ,因此它无法计算表达式。
真正的错误是 System.UnauthorizedAccessException
。
因此,打开您的Package.appxmanifest,转到Capabilities 选项卡并选中Document Library Access。
关于c# - Windows 8 - WriteTextAsync 异常 "Cannot evaluate expression because a native frame is on top of the call stack.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20960008/