Bug 27982

Summary: Inconsistent behavior in DynamicAttribute.Equals() method
Product: [Mono] Class Libraries Reporter: nader <nader.bushehri>
Component: mscorlibAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: masafa, mono-bugs+monodroid, mono-bugs+mono
Priority: ---    
Version: 3.12.0   
Target Milestone: Untriaged   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description nader 2015-03-12 15:05:12 UTC
It appears that there is some inconsistency in how System.Runtime.CompilerServices.DynamicAttribute.Equals method is implemented on Xamarin Android. Consider running the following code snippet:

System.Boolean v0 = (System.Boolean)true;
System.Boolean v1 = (System.Boolean)false;
System.Boolean v2 = (System.Boolean)false;
System.Boolean v3 = (System.Boolean)true;
System.Boolean[] v4 =  new System.Boolean[] {v0 , v1 , v2 , v3};
System.Runtime.CompilerServices.DynamicAttribute v5 =  new System.Runtime.CompilerServices.DynamicAttribute((System.Boolean[])v4);
System.Boolean v9 = (System.Boolean)true;
System.Boolean v10 = (System.Boolean)false;
System.Boolean v11 = (System.Boolean)false;
System.Boolean v12 = (System.Boolean)true;
System.Boolean[] v13 =  new System.Boolean[] {v9 , v10 , v11 , v12};
System.Runtime.CompilerServices.DynamicAttribute v14 =  new System.Runtime.CompilerServices.DynamicAttribute((System.Boolean[])v13);
System.Boolean v19 = ((System.Attribute)v5).Equals((System.Object)v14) ; 

Expected result:
 v19 == true
Xamarin Android result:
 v19 == false


.Net 4.5 and windows phone 8.1 return the expected result while Xamarin android return set the value of the variable to false.

The code snippet above was placed in a PCL project and was run on an android 4.4.2
emulator, a Windows Phone 8.1 emulator, and .Net 4.5 for the Desktop.

Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
Comment 1 Marek Safar 2015-03-16 06:02:57 UTC
Fixed in master