What are the challenges you face when working across database platforms? Take the survey
Options

[DoNotPruneType] doesn't work w/ static classes?

eric-914eric-914 Posts: 46
edited May 8, 2013 3:26PM in SmartAssembly
I've got a static class that is only referenced via XAML. S/A in turn thinks this static class is prunable, which it isn't.

If I mark the class [DoNotPruneType], and run, the program breaks because the class is missing.

If I flag the class from Pruning in the S/A configuration, things are OK.

How do I mark a static class as Do Not Prune?

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    You can try the [DoNotPrune] attribute - there is a subtle difference.
    DoNotPrune
    Excludes the type definition from pruning.
    Can be added to any type (class, enum, interface, and struct).

    DoNotPruneType
    Excludes the type definition, as well as all type's members, from pruning.
    Can be added to any type (class, enum, interface, and struct).

    If not let me know. There are all sorts of hard-coded exclusions and exceptions in SA to attempt to make XAML work so you may need to provide details.
  • Options
    I tried both, like the following:

    [DoNotPruneType]
    public static class X
    {
    [DoNotPrune]
    public static IY Y { get { return new Y(); }
    }

    This didn't help.

    Only by excluding it through the configuration, would it go.

    To be honest, I've given up applying "pruning" to anything in the project. The risk of instability it creates by taking something out that really is used has turned into a much bigger risk of just leaving any unused code in the project.
Sign In or Register to comment.