Bug 27982 - Inconsistent behavior in DynamicAttribute.Equals() method
Summary: Inconsistent behavior in DynamicAttribute.Equals() method
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.12.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2015-03-12 15:05 UTC by nader
Modified: 2015-03-16 06:02 UTC (History)
3 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 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