Exemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing && MonoWorkarounds.IsRequired(10163) && m_bWrite &&
                !m_bDisposed)
            {
                try
                {
                    Stream s = this.BaseStream;
                    Type   t = s.GetType();
                    if (t.Name == "WebConnectionStream")
                    {
                        PropertyInfo pi = t.GetProperty("Request",
                                                        BindingFlags.Instance | BindingFlags.NonPublic);
                        if (pi != null)
                        {
                            WebRequest wr = (pi.GetValue(s, null) as WebRequest);
                            if (wr != null)
                            {
                                IOConnection.DisposeResponse(wr.GetResponse(), false);
                            }
                            else
                            {
                                Debug.Assert(false);
                            }
                        }
                        else
                        {
                            Debug.Assert(false);
                        }
                    }
                }
                catch (Exception) { Debug.Assert(false); }
            }

            m_bDisposed = true;
        }