Bug 15401 - Reflection GetCustomAttributes returns empty results in mcs, but non-empty in gmcs
Summary: Reflection GetCustomAttributes returns empty results in mcs, but non-empty in...
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-10-15 09:32 UTC by Vitaliy Filippov
Modified: 2013-10-15 11:40 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Custom attributes test code (2.09 KB, application/octet-stream)
2013-10-15 09:32 UTC, Vitaliy Filippov
Details


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 Vitaliy Filippov 2013-10-15 09:32:24 UTC
Created attachment 5145 [details]
Custom attributes test code

Reflection GetCustomAttributes returns empty results in mcs, but non-empty in gmcs.

See the attached example. The output is as follows:

$ mcs test-customattr.cs ; mono test-customattr.exe
Member Void MyMethod(Int32):
  attr: MyAttribute
  param: Int32 i, class: System.Reflection.ParameterInfo, attrs: 0
  param: Object obj, class: System.Reflection.ParameterInfo, attrs: 0

$ gmcs test-customattr.cs ; mono test-customattr.exe
Member Void MyMethod(Int32):
  attr: MyAttribute
  param: Int32 i, class: System.Reflection.ParameterInfo, attrs: 1
    attr: MyAttribute
  param: Object obj, class: System.Reflection.ParameterInfo, attrs: 0

I.e. the parameter attribute shows up only when compiled with _older_ sdk!
Comment 1 Vitaliy Filippov 2013-10-15 11:40:15 UTC
Oh. Sorry. It seems that my test machine had unclean environment (some files left over from an old mono). I've tested it on another machine and it's all OK, then reinstalled mono on the previous one, and it also went OK.