[Mono-dev] Problems with FileStream.Lock();
jonpryor at vt.edu
Wed Jan 9 05:23:50 UTC 2013
On Jan 7, 2013, at 4:50 PM, Terry-Watts.com <Terry at Terry-Watts.com> wrote:
> I have a class that work fine in C# under Windows but not under Monodroid.
This is a mono bug: https://bugzilla.xamarin.com/show_bug.cgi?id=9411
Thinking about it a but more, though, it's an app bug (+ mono bug).
The problem is that Android doesn't have "large file support" (meaning userspace is limited to 32-bit values for file offsets/etc.). Your code, meanwhile, is specifying a 64-bit value for the file range.
fcntl(2) cannot accept a 64-bit value for the size of the file region to lock; it needs to be a signed 32-bit value.
Fix: use `int.MaxValue`, not `long.MaxValue`.
Mono should probably throw an exception in this scenario.
More information about the Mono-devel-list