[Mono-bugs] [Bug 675564] New: System.IO.Packaging.Package.Dispose disposes the creation stream too.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Feb 28 10:43:33 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=675564
https://bugzilla.novell.com/show_bug.cgi?id=675564#c0
Summary: System.IO.Packaging.Package.Dispose disposes the
creation stream too.
Classification: Mono
Product: Mono: Class Libraries
Version: unspecified
Platform: x86
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: AhHatem at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: Community User
Blocker: ---
Description of Problem:
System.IO.Packaging.Package.Dispose disposes the creation stream too.
using System;
using System.IO.Packaging;
using System.IO;
namespace test
{
class MainClass
{
public static void Main (string[] args)
{
MemoryStream stream = new MemoryStream ();
Package p = Package.Open (stream, FileMode.Create,
FileAccess.ReadWrite);
p.Close ();
stream.ReadByte();
}
}
}
throws this exception:
Unhandled Exception: System.ObjectDisposedException: The object was used after
being disposed.
at System.IO.MemoryStream.CheckIfClosedThrowDisposed () [0x00000] in
/usr/src/packages/BUILD/mono-2.10/mcs/class/corlib/System.IO/MemoryStream.cs:133
at System.IO.MemoryStream.ReadByte () [0x00000] in
/usr/src/packages/BUILD/mono-2.10/mcs/class/corlib/System.IO/MemoryStream.cs:261
at test.MainClass.Main (System.String[] args) [0x00000] in <filename
unknown>:0
the package.Close call internally makes this:
public void Close()
{
this.Flush();
this.Dispose(1);
}
for some reason the dispose call disposes the stream too....
Expected Results:
The stream should not be disposed and this is the behavior in .Net.
How often does this happen?
Always.
--
Configure bugmail: https://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