我很困惑的东西。MS.Internal.InternalMemoryStream在后台代理中变为MS.Internal.ReadOnlyBufferedStream?
我有一个Windows Phone 8应用程序,它利用后台代理计划任务。
其中,后台代理下载并使用unzipper found here提取.zip文件。 (解压缩功能在应用程序的常规非背景部分中工作正常。)
我注意到后台代理正在抛出一个System.NotImplementedException,并且我将其跟踪到Unzipper.ParseCentralDirectory中的一行代码
public sealed class Unzipper : IDisposable
{
private Stream stream;
...
正如我所提到的,unzipper功能可以运行在常规精细:()
private List<FileEntry> ParseCentralDirectory()
{
BinaryReader reader = new BinaryReader(this.stream);
//this next line is the one that's throwing the System.NotImplementedException
reader.BaseStream.Seek(-4, SeekOrigin.End);
在这种情况下,在BinaryReader在参数“this.stream”是在类的顶部限定主要应用。所以我在主应用程序和后台应用程序之间寻找代码段的差异(解压器类在主项目和后台代理项目中分别出现)。
我注意到流Unzipper(引用为“this.stream”)是一个MS.Internal.InternalMemoryStream。但是,当后台代理在后台Unzipper.cs中到达同一行时,“this.stream”是MS.Internal.ReadOnlyBufferedStream。
这是我发现的唯一区别。但是,我甚至不确定这是否是问题。它扔System.NotImplementedException上
reader.BaseStream.Seek(-4, SeekOrigin.End);
但MS.Internal.ReadOnlyBufferedStream呢,其实,有“真”(一个“CanSeek”财产我注意到Unzipper检查,并引发NotSupportedException如果是假的。)
我在这里难住了。实际上,使用Google搜索“MS.Internal.ReadOnlyBufferedStream”不会产生单一结果(尽管我猜测它现在会......)
谢谢你的回应。我尝试了这种方法,将文件下载到独立存储中,然后打开一个isolationStorageStream并将其传递给Unzipper的一个新实例。这会抛出“System.ArgumentException:流不可读”。 – 2013-04-11 22:06:00
另外,您能否详细说明基于网络的API在后台agnets中的差异?我似乎无法找到任何信息。 – 2013-04-14 22:22:18
您的第一个问题听起来像是在将文件流传递到压缩库之前处理文件流。 – 2013-04-15 08:26:18