I have a simple application for the Windows Universal Platform that I wrote primarily to teach myself UWP applications. It works fine, except that it seems somewhat random, "RPC Server Error Unavailable," created by the OpenReadAsync method on the StorageFile object.
The application simply creates a list of files to display, then iterates and displays each of them by timer. Most of the time it works great. I can let him work for hours without a problem. But from time to time I get an RPC error. It seems that when I leave the car for a long time, so that it logs me out, then I went back in and switched to my slideshow application. This does not happen every time, and if I try to reproduce, I can never refuse it. It seems that basically when I leave the car for a long time - like at night.
Here is the code that executes when an error occurs. This happens when the OpenReadAsync method is called.
StorageFile file = this._files.ElementAt(this._index++); await this._dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { var bitmap = new BitmapImage(); var stream = await file.OpenReadAsync(); await bitmap.SetSourceAsync(stream); this.Image = bitmap; });
If I try to open the file using the Windows Photo viewer, even if it sits with an error, it opens normally. But even retrying an unsuccessful line of code will not allow my application to open the file. All I can do is close and restart the application.
Does anyone come across anything like this? Any tips on where I should look?
Thanks.
Edit: Oh, one more thing - all the files are on the local drive. No external servers or network.
source share