[Mono-bugs] [Bug 685368] New: Behavior difference with HttpWebResponse.Close between Mono and .Net

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 5 20:09:14 EDT 2011



           Summary: Behavior difference with HttpWebResponse.Close between
                    Mono and .Net
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: aaron.bockover+novell at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

After calling Close () on an HttpWebResponse in Mono, the object will be
completely unusable as it's been marked as disposed. However, in .NET accessing
certain properties on the object is allowed after the Close () call, which
seems most reasonable.

I think Mono's implementation is too strict. Close should only free resources
that may otherwise not be collected during a regular GC and/or release
resources back into some pool for further immediate IO, etc.

Below is a simple test case. It will print the ResponseUri when running on .NET
("http://www.reddit.com" as of the time of this filing) but on Mono calling
get_ResourceUri will throw System.ObjectDisposedException.

using System;
using System.Net;

public static class HttpWebResponseDisposalTest
    public static void Main ()
        var request = (HttpWebRequest)HttpWebRequest.Create
        var response = request.GetResponse ();
        response.Close ();
        Console.WriteLine (response.ResponseUri);

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