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?
views:
559answers:
3Spring.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
PostSharp somewhat supports ILMerge. See http://www.postsharp.org/blog/postsharp-and-ilmerge. But there are problems with obfuscated assemblies.
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).
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).
-gael
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.