Clone wiki

BaseMemberPromotingProxy / Home


BaseMemberPromotingProxy is a (terribly named) class meant to be used as the target for the DebuggerTypeProxy attribute. The code is based off of Jared Parsons’ FlattenHierarchyProxy. Like the original, BaseMemberPromotingProxy (which will be referred to as BMPP throughout the rest of this documentation) is designed to improve the debugger displays of classes that inherit from other classes.

What is this?

For the sake of not duplicating content (read: I'm lazy), I describe what this is, as well as the motivation behind it, on my blog. This page is just meant to be documentation.


There is only a single source file, BaseMemberPromotingProxy.cs, so it's up to you whether you want to plop that file into your project or build a DLL from the source file. Either way, you'll need to import my namespace:

using MostThingsWeb;


Basic usage

The simplest way to use BMPP is to just apply this attribute to your class:

public class ParentClass : SubClass {}

Now, properties and fields from sub classes will appear side-by-side (be "promoted") with the members of the parent class.

Advanced usage

Let's say you don't want to promote every member from the subclasses; just specific ones. To do this, use the PromoteProperty or PromoteField attributes.

These attributes take a single parameter, the name of the property or field to promote. The name of the member is case sensitive.

Use of one or more PromotePropertys disables automatic promotion for all other subclass properties. In other words, BMPP is switched into "opt-in" mode for properties. So, if you use a PromoteProperty attribute to promote a specific property, only that property and the properties of the parent ("target") class will appear in the debugger display.

PromoteField exhibits the same exact behavior, but for fields instead of properties.

To illustrate these attributes, consider this example:

public class Poultry {
    // Fields
    private int _weight;

    // Properties
    public bool Delicious {
        get { return true; }

    public int Weight { /* get/set backing field _weight */ }

// !!! Attributes from table below go here !!!
public class Chicken : Poultry {
    // Fields
    private bool _hen = true;

    // Properties
    public String Sound {
        get { return "Cluck"; }

Let's consider what happens when different combinations of PromoteProperty and PromoteField attributes are applied to the Chicken class, in addition to the DebuggerTypeProxy, which is always necessary. X denotes the members that the debugger display will show.

[PromoteProperty("Weight"), PromoteProperty("Delicious")]XXXXX

Here's what you should take away from this chart:

  • No matter what you do, parent (where the BaseMemberPromoteProperty attribute is applied to) members are always shown
  • The PromoteProperty attribute switches BMPP into "opt-in" mode for properties.
  • The PromoteField attribute switches BMPP into "opt-in" mode for fields.
  • PromoteProperty has no effect on fields, nor does PromoteField have any effect on properties.
  • Specifying non-existent members has no effect, other than to switch on "opt-in" mode for that member type.

Future improvements

Please comment on my blog or submit a BitBucket issue if any of the following interest you:

  • An "opt-out" mode
  • Different sort behavior on debugger displays (for example, separately sorting fields and properties)


This project is licensed under an MIT license. Please see licenses text in the main source file, BaseMemberPromotingProxy.cs.