Bug 46175

Summary: If the RSA will be used by multiple threads, it has a variety of exceptions.
Product: [Mono] Class Libraries Reporter: Ryoji.Ishikawa
Component: mscorlibAssignee: Marek Safar <masafa>
Status: VERIFIED FIXED    
Severity: normal CC: kumpera, masafa, mono-bugs+monotouch, mono-bugs+mono, sachins
Priority: ---    
Version: 4.8.0 (C9)   
Target Milestone: 4.8.0 (C9)   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Ryoji.Ishikawa 2016-10-31 02:19:33 UTC
Sample code
==================================================
using System.Threading;
using System.Threading.Tasks;
using System.Security.Cryptography;

private const string key = "<RSAKeyValue><Modulus>vtnLJ+7rLT96dpDH2J8jXv1EooT/1P71Q6PM30f4ycBWp/SeW9Jdlh26jkfAIH9AscWSPK5gMGJYFKWn3i5bC34fWZEdumyaHPo41TcKd3Yu585eNkJTTqyZ4IUuA0GdW2b/NoqF4thkE2G0ebUBFQ3kqiyprvrJ5lG6ALDX44c=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

private void test() {
  Parallel.For(0, 10, (val) =>
  {
    using (RSA rsa = RSA.Create())
    {
      rsa.FromXmlString(key);
    }
  });
}
==================================================


Exceptions
-Input string does not contain a valid encoding of the 'RSA' 'Modulus' parameter.
-Input string does not contain a valid encoding of the 'RSA' 'Exponent' parameter.
-Invalid length for a Base-64 char array or string.


Other
-This problem is from around April 2016.
-100% reproducibility.
-This problem occurs in the device and in iOS simulator.
-This problem does not have the .NET Framework.
Comment 1 Marek Safar 2016-10-31 12:02:08 UTC
Fixed in master and Mono 4.8.
Comment 2 Sachin Saini 2016-11-21 11:59:16 UTC
I have checked this issue with latest master and cycle9 builds and observed that this issue has been fixed now.here is the screencast for the same: http://www.screencast.com/t/I21Xqbt9

Master environment info: https://gist.github.com/sachins360/21cc4f09da3b55f343f12d4ea34b22d3
Cycle9 environment info: https://gist.github.com/sachins360/8ab3c8885f387f97ece82f8c8e7f3e91

Hence,I am verifying this issue.

Thanks!