Bug 11666 - RSACryptoServiceProvider is not IDisposable
Summary: RSACryptoServiceProvider is not IDisposable
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Security ()
Version: master
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-04-09 05:25 UTC by Ciprian Khlud
Modified: 2013-05-16 15:11 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 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:
Status:
RESOLVED INVALID

Description Ciprian Khlud 2013-04-09 05:25:23 UTC
When the .Net implementation is:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx

Quote:
Dispose()
Releases all resources used by the current instance of the AsymmetricAlgorithm class. (Inherited from AsymmetricAlgorithm.)

If Mono doesn't need to dispose it, it should provide an empty Dispose method to not give compiler errors when compiling both Mono and .Net source.
Comment 1 Sebastien Pouliot 2013-05-16 15:11:52 UTC
RSACryptoServiceProvider is, and always was, IDisposable because it inherits from AsymmetricAlgorithm which is IDisposable.

The AsymmetricAlgorithm.Dispose method was not public before .NET 4.0 (but still callable using IDisposable [1]). 

MS added it in .NET 4.0 and recent Mono releases (e.g. 3.0.x) also have it [2] if you're compiling againt the 4.0+ profiles. If you're using an older Mono or profile (e.g. 2.0) then you'll need to update it.


[1] e.g.

IDisposable d = new RSACryptoServiceProvider ();
d.Dispose ();


[2] https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs#L68