Home Dashboard Directory Help

Certain method calls on an IsolatedStorageFileStream throw an exception by Brandon Siegel


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 539486
Opened: 3/5/2010 7:07:55 AM
Access Restriction: Public
User(s) can reproduce this bug


IsolatedStorageFileStream does not override certain public members of its base FileStream class, including GetAccessControl, SetAccessControl, Lock, and Unlock. When these methods are called, the base FileStream implementation is executed and because of how IsolatedStorageFileStream was implemented, these method calls throw a NullReferenceException.

This occurs on down-level versions of the .NET framework as well.
Sign in to post a comment.
Posted by Microsoft on 5/12/2010 at 4:17 PM
Hi Brandon,

Thanks for bringing this issue to our attention. I wanted to let you know that we've fixed this bug for a future release of the .NET Framework. Please let me know if you have any more questions about the issue.

Matt Ellis
Software Design Engineer
Base Class Libraries
Posted by Microsoft on 3/8/2010 at 12:56 AM
Thank you for reporting the issue.
We were able to reproduce the issue with the detail steps you provided.We are routing this issue to the
appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/5/2010 at 7:05 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Brandon Siegel on 3/5/2010 at 8:49 AM
If you retrieve the IsolatedStorageFileStream's private 'm_fs' member via reflection, you can call these methods on that FileStream object instead, and everything seems to work fine:

    lockStream = new IsolatedStorageFileStream("q.lck", FileMode.OpenOrCreate, isoStore);
    FileStream m_fs = typeof(IsolatedStorageFileStream).InvokeMember(("m_fs"), BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance, null, lockStream, null) as FileStream;
    m_fs.Lock(0, lockStream.Length);