skevar7
skevar7

Reputation: 1005

Any PostSharp alternative?

I have to abandon using PostSharp, because it won't work with obfuscated/merged assemblies. At least, I don't see any way to get it working (it crashes on app start, when assemblies are obfuscated)
I need to intercept some methods in my app (call special code instead of original methods - OnMethodInvocationAspect)
Any advice?

Upvotes: 4

Views: 8433

Answers (4)

Gael Fraiteur
Gael Fraiteur

Reputation: 6857

PostSharp somewhat supports ILMerge. See http://www.postsharp.org/blog/postsharp-and-ilmerge. But there are problems with obfuscated assemblies.

  1. Since aspects are serialized at build time, they cannot be deserialized if the aspect type has been obfuscated. The solution is not to obfuscate any serializable type. Another solution is not to serialize aspects (see AspectConfigurationAttribute.SerializerType in PostSharp 2.0, and use the serializer MsilAspectSerializer).

  2. There are problems when aspects are applied to generic methods and methods of generic types (the reason is that PostSharp uses reflection, based on method names, in this case, to work around bugs in the CLR).

Upvotes: 4

Sagi
Sagi

Reputation: 9294

NCop is a composite-aspect framework for the .NET platform inspired by Post Sharp

Sheep Aspect is an alternative open source AOP tool for the .NET platform inspired by AspectJ

Upvotes: 3

Ira Baxter
Ira Baxter

Reputation: 95400

Aspect-oriented programming is just a special case of program transformation. If you can apply program transformations using a tool, you can do AOP easily.

Our DMS Software Reengineering Toolkit is a program transformation engine that handles many real languages, including C, C++, Java, COBOL and even C#4.0.

See Aspect Oriented Programming using DMS for more details.

Upvotes: 1

Iain
Iain

Reputation: 2550

Spring.NET has AOP features which are weaved at runtime so should work with obfuscated assemblies.

http://www.springframework.net/

Documentation:

http://www.springframework.net/doc-latest/reference/html/aop.html

Upvotes: 1

Related Questions