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

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, melvyn.harbour, dom.smith

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

Postby eric-914 » Fri May 03, 2013 4:07 pm

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?
eric-914
 
Posts: 28
Joined: Fri Nov 30, 2012 5:51 pm

Postby Brian Donahue » Mon May 06, 2013 11:14 am

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.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby eric-914 » Wed May 08, 2013 8:26 pm

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.
eric-914
 
Posts: 28
Joined: Fri Nov 30, 2012 5:51 pm


Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests