Bug 21771 - XmlReader.Dispose() calls Dispose(false)
Summary: XmlReader.Dispose() calls Dispose(false)
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: 3.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2014-08-01 13:53 UTC by Dave Dunkin
Modified: 2014-09-23 10:48 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dave Dunkin 2014-08-01 13:53:25 UTC
XmlReader.Dispose() incorrectly calls Dispose(false). This differs from the .NET implementation. It should call Dispose(true). The Dispose(bool) code also incorrectly ignores the disposing parameter.

This is particularly problematic when using PCLs because there isn't a Close() method to override.

The following program works on .NET 4.5 and crashes on Mono 3.4.0.

using System;
using System.Xml;

namespace XmlReaderBugs
	class Program
		static void Main(string[] args)
			var reader = new MyXmlReader();

	class MyXmlReader : XmlTextReader
		protected override void Dispose(bool disposing)
			if (!disposing)
				throw new InvalidOperationException();
Comment 1 Marek Safar 2014-08-03 13:11:37 UTC
Fixed in master
Comment 2 Udham Singh 2014-09-23 10:48:21 UTC
I have checked this issue on MonoFramework-MDK- and able to reproduce with the same build.

I have also checked this issue with MonoFramework-MDK- and observed that this issue is working fine with Mono

Screencast : http://screencast.com/t/IdwVi5jnTNW

Hence closing this issue.

Environment Info :

=== Xamarin Studio ===

Version 5.5 (build 204)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 3.10.0 ((detached/ac51002)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000016

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 3b73f2a
Build date: 2014-09-19 00:21:20-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Build Information ===

Release ID: 505000204
Git revision: 2affa3acc16487d4f8fb5cb33c49e2423469091e
Build date: 2014-09-23 07:14:56-04
Xamarin addins: c31fea2f959659225466adef1c0793a8d7eebcef

=== Operating System ===

Mac OS X 10.9.4
Darwin Xamarin76s-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64