Bug 10391 - Better handling of anonymous types
Summary: Better handling of anonymous types
Status: RESOLVED NORESPONSE
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-02-18 16:56 UTC by Mikayla Hutchinson [MSFT]
Modified: 2017-07-07 19:09 UTC (History)
6 users (show)

Tags:
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:
Status:
RESOLVED NORESPONSE

Description Mikayla Hutchinson [MSFT] 2013-02-18 16:56:00 UTC
Anonymous types have auto properties back by a field named "<Foo>" where Foo is the property name.

Currently the debugger shows the fields and the properties, which is redundant. We should treat them like other auto properties - hide the backing field entirely, and make debugger calls to the property get/set the backing field directly.
Comment 1 Marek Safar 2013-02-20 15:45:05 UTC
No need for any special hacking they have DebuggerBrowsable set (at least tested with mono 3.0)
Comment 2 Jeffrey Stedfast 2013-02-20 17:23:04 UTC
For some reason, FieldInfoMirror.GetCustomAttributes (true) is retuning an empty array of CustomAttributeMirrors for fields in anonymous types even though I can clearly see DebuggerBrowsableAttributes in the disassembled IL.

We can probably work around this in MonoDevelop, but it'd be nice if the runtime returned the proper attributes.


I've updated the MonoDevelop logic to shortcut evaluation of the anonymous type's properties by just poking the appropriate field value, though.
Comment 3 Marek Safar 2013-02-21 03:50:37 UTC
I tested simple "var a = new X { foo = 3 } and it worked for me on Mono 3
Comment 4 Zoltan Varga 2013-02-23 17:33:06 UTC
Jeff: I can't reproduce this with master, I can repro with 2.10, but only because mcs doesn't seem to generate the DebuggerBrowsable attribute there.
Comment 5 Zoltan Varga 2013-09-16 15:19:16 UTC
Jeff: Does the problem in #2 still happens ?
Comment 6 Ludovic Henry 2017-07-07 19:09:06 UTC
If you can still reproduce with latest mono version, please feel free to reopen the bug. Thank you.