Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Autoproperties creating non-xml-conform backingfield names "<myAutoProperty>k__BackingField" #1

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Add in "SampleTestFixture.cs" in "MyClassUnderTest" the following
autoproperty: public string MyProperty { get; set; }
2. Run test SampleTestFixture CanSerialize() and watch xmlText

What is the expected output? What do you see instead?
Expected:
<f name="MyProperty">
  <string value="some test content" />
</f>

Instead of
<f name="<MyProperty>k__BackingField">
  <string value="some test content" />
</f>

What version of the product are you using? On what operating system?
r127 or r115 (didn't work either), WinXp VS2010 .NET 4.0

First of all: Good work! 
We've a big dom with lot of dependency injection (ninject) and a lot of
interfaces or interfaces of lists of interfaces that should be serialized
and that's why I checked out your nserializer.
There's one big problem: We just want to serialize properties, because only
properties can be defined on interfaces. Private Fields should not be
serialized in our project. Now I reviewed your framework and I could not
solve the naming problem. If you get the properties with the
type.GetProperties(BindingFlags...), they're named correctly and the
MemberType is Property, but their (invisible) backing field is also read by
type.GetFields(BindingsFlags...). If I set the fields to empty array and
only took the Properties, there was no output...

I'm looking forward to use nserializer in our project. For more information
or contact (skype, email) please contact me on kuermX at gmail

Thanks in advance

Martin

Original issue reported on code.google.com by kue...@gmail.com on 12 Mar 2010 at 9:58

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions