Red Gate forums :: View topic - [DoNotPruneType] doesn't work w/ static classes?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

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

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
eric-914



Joined: 30 Nov 2012
Posts: 28

PostPosted: Fri May 03, 2013 4:07 pm    Post subject: [DoNotPruneType] doesn't work w/ static classes? Reply with quote

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?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6673

PostPosted: Mon May 06, 2013 11:14 am    Post subject: Reply with quote

Hello,

You can try the [DoNotPrune] attribute - there is a subtle difference.
Quote:

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.
Back to top
View user's profile Send private message
eric-914



Joined: 30 Nov 2012
Posts: 28

PostPosted: Wed May 08, 2013 8:26 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group