[DoNotPruneType] doesn't work w/ static classes?
eric-914
Posts: 46
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?
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
You can try the [DoNotPrune] attribute - there is a subtle difference.
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.
[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.