读书人

创建IsolatedStorageFileStream时发生

发布时间: 2013-07-24 14:36:29 作者: rapoo

创建IsolatedStorageFileStream时发生异常异常
本帖最后由 kiygaven 于 2013-07-07 11:53:33 编辑 我使用Socket从pc端向wp发送文件
在wp端创建IsolatedStorageFileStream对象时发生错误
异常信息如下
[IsolatedStorage_Operation_ISFS]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50829.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS

发生异常的位置是一个自定义事件,红色语句
private void ssReceiver_ReceiveFileCompleted(object sender, SocketOperatorEventArgs e)
{
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
...
using (IsolatedStorageFileStream isfs =isf.CreateFile(Path.Combine("Folder", ssReceiver.SocketFile.FileName)))
{
...
}
}
}

事件的调用是在SocketAsyncEventArgs的Completed事件中
该自定义事件如下
public delegate void ReceiveFileCompletedEventHandler(object sender, SocketOperatorEventArgs e);
public event ReceiveFileCompletedEventHandler ReceiveFileCompleted;

protected virtual void OnReceiveFileCompleted(SocketOperatorEventArgs e)
{
if (this.ReceiveFileCompleted != null)
this.ReceiveFileCompleted(this, e);
}


void ReceivesCompleted(object sender, SocketAsyncEventArgs e)
{


...
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
this.ReceiveFileCompleted(this, new SocketOperatorEventArgs() { ... });
});
...
}

请问这个异常是由于线程的问题吗,该如何解决。 Windows?Phone
[解决办法]

引用:
我试了下,放在button里面也不行……
还是报这个异常。

这个工程是vs2012,wp8模拟器,工程是wp7.1的,跟这个有关系?
这个问题更糊涂了……

没有实现创建这个Folder文件夹吧。

using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
//...
isf.CreateDirectory("Folder");
using (IsolatedStorageFileStream isfs = isf.CreateFile(Path.Combine("Folder", ssReceiver.SocketFile.FileName)))
{


//...
}
}



麻烦你想回复谁请先引用谁下,,,不然还要别人翻帖子找来找去,,,

读书人网 >Windows Mobile

热点推荐