[IronPython] The Overloading Story, IsolatedStorage (Silverlight)
dinov at microsoft.com
Mon Apr 6 17:17:08 CEST 2009
For the read case what happens if you explicitly pass FileShare.None instead of FileShare.Read? The reason I ask is the default for FileShare is FileShare.None unless FileAccess == FileAccess.Read.
We should just be picking the ctor w/o parameters here so my guess is that the default values are actually behaving in a surprising way. But then again IsolatedStorage is a bit of a magical API (at least on the desktop CLR) so there is a possibility that something weird is happening here.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of David Seruyange
Sent: Sunday, April 05, 2009 6:50 AM
To: Discussion of IronPython
Subject: [IronPython] The Overloading Story, IsolatedStorage (Silverlight)
What is the story on overloading with IronPython? From Michael Foord's IronPython in Action p. 208:
"[Overloading] largely works seemlessly in IronPython... If IronPython gets it wrong, it's a bug and you should report it on the IronPython mailing list or the issue tracker on the IronPython CodePlex site!"
I've been recently implementing some Silverlight + IronPython and ran into trouble with IsolatedStorage. Specifically, there are overloads for the OpenFile method as follows:
OpenFile(string path, FileMode mode)
OpenFile(string path, FileMode mode, FileAccess access)
OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
In order to open the file for reading, I found that the two parameter version was inadequate:
ioStorage = IsolatedStorageFile.GetUserStoreForApplication()
ioStorage.OpenFile("foo.text", FileMode.Open) # FAIL
But passing all parameters led to success:
ioStorage.OpenFile("foo.text", FileMode.Open, FileAccess.Read, FileShare.Read) #WIN
Interestingly enough, I can succeed in writing to a file when I don't pass a FileShare parameter:
ioStorage.OpenFile("foo.text", FileMode.Append, FileAccess.Write)
I would assume there would be some issue with incompatibility with the defaults for the parameter assignment but when I use a C# project I can succeed with the stripped down calls to create a filestream in IsolatedStorage.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users