Bug 44010 - Error retrieving custom attribute specified on member in ancestor class
Summary: Error retrieving custom attribute specified on member in ancestor class
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: 4.8.0 (C9)
Assignee: Aleksey Kliger
Depends on:
Reported: 2016-09-06 10:18 UTC by Arne De Vreese
Modified: 2016-11-17 11:51 UTC (History)
5 users (show)

Is this bug a regression?: No
Last known good build:

Test Project (201.44 KB, application/x-zip-compressed)
2016-09-06 10:18 UTC, Arne De Vreese
Desktop Mono test case (3.75 KB, application/zip)
2016-09-10 01:17 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Arne De Vreese 2016-09-06 10:18:42 UTC
Created attachment 17337 [details]
Test Project

## Description

Attributes specified on properties in ancestor classes are not always found.

## Steps to reproduce

Launch the attached test project to an Android or iOS device or simulator.

Expected result: for all 3 items the custom attribute 'DemoAttribute' on the property 'Property' should be found, resulting in a black label text indicating this.

Actual result: for the first 2 items the custom attribute is found, but for the third item the attribute is not found, resulting in a red label text specifying that the attribute is not found.

## Notes

The same code on a pure .NET environment gives the expected result.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-10 01:17:53 UTC
Created attachment 17404 [details]
Desktop Mono test case

## Regression status: Not a regression, or at least not a recent regression

BAD: Mono 4.6.0 (dea2155)
BAD: Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45
BAD: Mono 4.2.4 (71b88f3)

## Steps followed to replicate

Build and run the attached (Desktop Mono) test case, based on the original test case from Comment 0.

## Results

> Attribute found in NonAbstractDescendant
> Attribute found in DescendantOfNonAbstractAncestor
> Attribute not found in DescendantOfAbstractAncestor

## Results in Windows 10, VS 2015 Update 3

> Attribute found in NonAbstractDescendant
> Attribute found in DescendantOfNonAbstractAncestor
> Attribute found in DescendantOfAbstractAncestor
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-10 01:40:56 UTC
## Additional result: this appears to be a runtime issue rather than a compiler issue

Compile the app using Mono. Run the app on Windows using .NET.

Results: GOOD (all 3 attributes are "found")
Comment 3 Marek Safar 2016-09-15 15:51:33 UTC
This looks like an issue in MonoMethod_get_base_method
Comment 5 Naqeeb 2016-09-29 18:26:08 UTC
I have checked this issue with latest master XVS build and observed that I am still getting same issue. Here is the screencast for the same: http://www.screencast.com/t/hCgSyb8jj2Zn

Environment info: https://gist.github.com/Arpit360/def7acdf677aa45fdc47ae36584b8254

Hence reopen this issue.
Comment 6 Aleksey Kliger 2016-11-08 18:28:03 UTC
This has nothing to do with XVS; it was a pure Mono runtime bug. Try the latest mono-4.8.0-branch mono and the "desktop mono test case", or XA/XM now that their mono dependencies include the commit with the fix.
Comment 7 Naqeeb 2016-11-17 11:51:00 UTC
I have checked this issue with MonoFramework-MDK- and the "desktop mono test case" observed that it is working fine. Here is the screencast for the same: http://www.screencast.com/t/34i89xmZ6R5Z

Environment info: https://gist.github.com/NaqeebAnsari/d7d44892be55905ea3fb370f1c6b5a81

Hence closing this issue.