[Mono-bugs] [Bug 603378] New: sharing the SafeFileHandle from FileStream does not behave like Microsoft's .NET FileStream

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 6 11:30:50 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=603378

http://bugzilla.novell.com/show_bug.cgi?id=603378#c0


           Summary: sharing the SafeFileHandle from FileStream does not
                    behave like Microsoft's .NET FileStream
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: adam.amitai at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=360152)
 --> (http://bugzilla.novell.com/attachment.cgi?id=360152)
repro and solution proposal

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3

In case of two instances of FileStream, that share the same SafeFileHandle, or
a user using the FileStream's SafeFileHandle with some native API - the
Position property and Seek method, as well as the Write() orders do not behave
not correctly, or like Microsoft's FileStream for that matter, because of the
internal buffering implementation.

Another side effect is that when getting a SafeFileHandle in case that the
FileStream is the handle owner (by calling the SafeFileHandle getter) - the new
SafeFileHandle returned by the getter marked owner, which in turn causes the
mono runtime to report a warning about trying to unref an unused handle at
Disposal.

For that bug i have consulted jonp on the IRC chat.



Reproducible: Always

Steps to Reproduce:
I have attached a two files:
exposed-handle-repro.cs  - The repro for the bug
exposed-handle-patch.diff - a (proposed) patch to solve the issues

gmcs exposed-handle-repro.cs
/exposed-handle-repro.exe

Actual Results:  
The output is AAA.(the print of the stream).
further more you can see the error returned by the second problem (the owner
problem). 

Expected Results:  
The output should be: AAABBB(the print of the stream).
And should quit gracefully.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list