C# 设备未联网时,UWP BackgroundDownloader().CreateDownload()或CreateStreamedFileFromUriAsync()

C# 设备未联网时,UWP BackgroundDownloader().CreateDownload()或CreateStreamedFileFromUriAsync(),c#,uwp,storagefile,C#,Uwp,Storagefile,在我的应用程序中,我必须从REST uri获取本地web服务器中的一些文件,如“然后将它们复制到应用程序的本地存储中,因此我继续执行以下操作: StorageFolder fileFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("MyFiles"); StorageFile file =await fileFolder.CreateFileAsync(filename, CreationCollisionOpti

在我的应用程序中,我必须从REST uri获取本地web服务器中的一些文件,如“然后将它们复制到应用程序的本地存储中,因此我继续执行以下操作:

StorageFolder fileFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("MyFiles");
StorageFile file =await fileFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);

var download = new BackgroundDownloader().CreateDownload(source, file);
await download.StartAsync();
StorageFile file = await StorageFile.CreateStreamedFileFromUriAsync(filename, source, RandomAccessStreamReference.CreateFromUri(source));
或者像这样:

StorageFolder fileFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("MyFiles");
StorageFile file =await fileFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);

var download = new BackgroundDownloader().CreateDownload(source, file);
await download.StartAsync();
StorageFile file = await StorageFile.CreateStreamedFileFromUriAsync(filename, source, RandomAccessStreamReference.CreateFromUri(source));
这在网络上的任何设备上都可以正常工作,这些设备都有IP,但当设备不在任何网络上(拔下RJ45或未连接到任何Wifi)时,代码会毫无错误地卡在这些线路上。我可以在调试中看到,程序只是等待异步方法完成,但从未发生过。 如果在调试过程中,我再次插入RJ45或连接到Wifi,异步方法现在结束并正常工作

这是正常行为吗?我知道,为了从uri获取文件,设备必须联网,但是本地uri呢