Bug 325359 (MONO82692) - [automatic properties] generated field's name is unrelated to property name
Summary: [automatic properties] generated field's name is unrelated to property name
Status: RESOLVED FIXED
Alias: MONO82692
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Marek Safar
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-04 19:07 UTC by Jan Oravec
Modified: 2007-11-13 10:08 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:52:01 UTC


---- Reported by jan.oravec@6com.sk 2007-09-04 12:07:05 MST ----

This is more wish than bug. It would be nice if generated field name was
predictable from property name in automatic properties so that when object
is serialized, class modified (e.g. changed order of properties), then
deserialized, it would still work. Application with data model in db4o is a
good example which would benefit from stable field name.

I am not sure what specification says, but it seems that MSFT recognized
this problem and recently changed .NET to use field name
"<Name>k__BackingField" when property name is "Name".

There are 2 recent articles with IL code showing usage of this new name:

http://jmayo.spaces.live.com/blog/cns!5F243997972597CE!444.entry
http://footheory.com/blogs/bennie/archive/2007/08/02/new-features-in-c-3-0-part-3-automatic-properties-object-initializers-and-collection-initializers.aspx

I do not have any MSFT products around, so I was not able to check this.

It would be nice if Mono use same name pattern, so that serialization is
compatible between Mono and .NET.


Unknown operating system unknown. Setting to default OS "Other".

Comment 1 Marek Safar 2007-11-13 10:08:44 UTC
Fixed in SVN.