[MonoTouch] UnauthorizedAccessException while accessing resources

Jeff Stedfast jeff at xamarin.com
Mon Oct 31 11:21:19 EDT 2011


Hi FlyingDevStudio,

FileStream(filename, FileMode.Open); tries to open the stream as
ReadWrite as per [
http://msdn.microsoft.com/en-us/library/47ek66wy.aspx ], this is
probably the reason for the failure.

Hope that helps,

Jeff

On Sat, Oct 29, 2011 at 8:24 PM, flyingdevstudio
<admin at flyingdevelopmentstudio.com> wrote:
> Actually solved the problem...
>
> Not sure what changed, if it's our code or something in the implementation
> of FileStream, but using a different overload of the FileStream constructor
> solved the problem.
>
> This one works:
> var fileStream = FileStream(filename, FileMode.Open, FileAccess.Read,
> FileShare.Read);
>
> This one wouldn't:
> var fileStream = FileStream(filename, FileMode.Open);
>
> Maybe this answer will help someone with the same problem :)
>
> --
> Matt
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/UnauthorizedAccessException-while-accessing-resources-tp3952060p3952083.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>


More information about the MonoTouch mailing list