Bug 154 - unable to call BinaryReader.Dispose()
Summary: unable to call BinaryReader.Dispose()
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 1.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-02 18:01 UTC by anthony taranto
Modified: 2011-09-18 11:44 UTC (History)
2 users (show)

Tags:
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 Developer Community or GitHub 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:
Status:
RESOLVED FIXED

Description anthony taranto 2011-08-02 18:01:49 UTC
The following code:

var reader = new System.IO.BinaryReader(null);
reader.Dispose();

produces the following error:

Error	1	'System.IO.BinaryReader.Dispose(bool)' is inaccessible due to its protection level	C:\Users\ataranto\rdio\mobile\astromech\RegexTest\Activity1.cs	35	20	RegexTest

casting reader to IDisposable does allow me to call the parameterless Dispose() method.
Comment 1 Sebastien Pouliot 2011-09-18 11:44:42 UTC
The mobile products were based on the Silverlight (2.1) profile and are slowly moving toward the 4.0 profile. This is a case where the 4.0 API was not exposed. This one is fixed and will be part of future releases. Thanks for the report!

p.s. your workaround (casting to IDisposable) will work perfectly.