IsolatedStorageFile用法抛出AbandonedMutexException

时间:2011-08-01 21:09:02

标签: silverlight isolatedstorage

我正在使用Silverlight 4.0中的方法维护一些代码,该方法抛出了

  

IsolatedStorageException没有足够的可用空间来执行操作。

,直到我在C:\ Documents and Settings \(用户)\ Local Settings \ Application Data目录中为其创建了目录。

现在让我更烦人了
  

发生了System.Exception     消息=由于废弃的互斥锁而导致等待完成。     堆栈跟踪:          在System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle,Int64 millisecondsTimeout,Boolean hasThreadAffinity,Boolean exitContext)     InnerException:null

以下代码在调用IsolatedStorageFile.GetUserStoreForApplication()

时抛出此异常
public object Getfromcache()
    {

        try
        {
            using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
            using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("AppCache/" + cachekey, FileMode.Open, file))

                if (stream.Length > 0)
                {
                    return serializer.ReadObject(stream);
                }
                else
                {
                    return null;
                }
        }
        catch
        {
            return null;
        }
    }

此代码之前没有给我带来任何问题。有人看到一些可怕的错误吗?

0 个答案:

没有答案