Postsharp: Method signature for Aspect
Can i specify that an OnMethodInvocationAspect can only be applied to a specific method signature, for exemple "int methodname(ClassA obj)" ? ...
Can i specify that an OnMethodInvocationAspect can only be applied to a specific method signature, for exemple "int methodname(ClassA obj)" ? ...
I am working on a unit testing project. This project has roughly 2600 test classes with an average of 15 unit tests per class. I'm not sure how many more classes I need to add to this project to recreate the error mentioned below, but I do know that adding a large amount (I tried 500) of files to the project is directly related to it. If...
We are evaluating PostSharp for logging purposes to use in a our project (implemented in .Net). Currently it is running in production enviroment. Can mixing with PostSharp raise licencing issues? As far as I know it is partially free. Am I wrong? What future licencing problems (i.e. is PostSharp planning to be non-free for future release...
Hi all, I have stumbled on an impossibly good performance behaviour with PostSharp. To evaluate the speed I wrote a little program, that would execute one function a specified number of times, and if PostSharp is enable it would generate and delete a few hundred strings, just in memory (non fixed composition, so they are not auto-intern...
We have an application here which is using postsharp to wrap certain methods within a transaction aspect derived from MethodInterceptionAspect. We use NHibernate 2.0 as an ORM for the application. There is a failure within this block of code, public override void OnInvoke(MethodInterceptionArgs args) { using (TransactionScope trans...
I would like to run profiling code against some services running in testing and production. My plan is to use PostSharp to implement a class that looks like public class TimerAttribute : OnMethodBoundaryAspect { //some data members //... public override void OnEntry(MethodExecutionEventArgs eventArgs) ...
Presently, I am checking the method name in the OnMethodBoundaryAspect.OnExit method: [Serializable] public class TimerAttribute : OnMethodBoundaryAspect { public override void OnExit(MethodExecutionEventArgs eventArgs) { if(eventArgs.Method.DeclaringType.Name == "Program" && eventArgs.Method.Name == "Main") ...
So I'm looking at PostSharp and I noticed that this isn't using runtime generated proxies but it is actually giving hints to the compilation process to include the aspects within the IL. So my initial thought were wow, how the heck is this done. Any pointers where I should be looking? ...
Hi, Using PostSharp, is it possible to only "attach" to methods having the WebMethod-attribute? Ex: [Trace][WebService] public partial class Service : System.Web.Services.WebService { // Caught by PS(WebMethod-attribute) [WebMethod] public void MyMethod() { return; } // Not caught by PS public void...
So we all know that C# doesn't have a C-like macro pre-processor (and there's a good thread on why here). But now that AOP is gaining traction, it seems like we're starting to do stuff with post-processors that we used to do with pre-processors (bear in mind that I am only getting my feet wet with PostSharp so am perhaps off base). I am...
Hi! I tried to use code protection (code is encrypted and can't be reflected) made by clisecure with postsharp but secured dlls won't compile when post sharp is used in solution. I use just PostSharp.Laos and PostSharp.Public Have You ever tried such combination? Did you manage to make it work. If so please tell what obfuscation tool an...
Hi, I would like to define a constrait on my custom (PostSharp) attribute. My goal is to get error or warning while compile time, if class X dont implements Y interface but it has my attribute. So this should work: [MyAttributeOnlyForY] public class X : Y { ... } but this should break the compile process: [MyAttributeOnlyForY] publ...
I'm wondering what the best way to do this is... I'm interested in introducing PostSharp into one of my projects, but I'm not sure how to unit test classes marked with an attribute properly. For example: public class hello { [MyAspectThatDoesSomethingToTheDatabaseWhenThisMethodGetsCalled] public int omg(string lol) { /...
I want to be able to apply an attribute to an interface so that every method in any class that implements that interface will have the attribute applied to it. I assumed it would look something like this: [Serializable] [AttributeUsage(AttributeTargets.All, Inherited = true)] public sealed class TestAttribute : OnMethodBoundaryAspect {...
I've followed the examples that come with postsharp 1.5 .. And I've a two simple projects: One has an aspect like this: [Serializable] public class MyAspectAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionEventArgs eventArgs) { Console.WriteLine(eventArgs.Method.Name); base.OnEntr...
I've recently started experimenting with PostSharp and I found a particularly helpful aspect to automate implementation of INotifyPropertyChanged. You can see the example here. The basic functionality is excellent (all properties will be notified), but there are cases where I might want to suppress notification. For instance, I might ...
Hello all. Im new to .NET and WPF so i hope i will ask the question correctly. I am using INotifyPropertyChanged implemented using PostSharp 1.5: [Serializable, DebuggerNonUserCode, AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = false, Inherited = false), MulticastAttributeUsage(MulticastTargets.Clas...
I'd like the aspect to exit a method invocation based on a condition like the following: [AttributeUsage(AttributeTargets.Method)] public class IgnoreIfInactiveAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionEventArgs eventArgs) { if (condition) { ...
A few months back I've discovered PostSharp, and for a time, it was good. But then legal came back with an answer saying that they don't like the licence of the old versions. Then the department told me that 2.0's price was unacceptably high (for the number of seats we need)... I was extremely disapponted, but not disheartened. Can't be...
I am working on a project where we have several attributes in AssemblyInfo.cs, that are being multicast to methods of a particular class. [assembly: Repeatable( AspectPriority = 2, AttributeTargetAssemblies = "MyNamespace", AttributeTargetTypes = "MyNamespace.MyClass", AttributeTargetMemberAttributes = MulticastAttributes.Public, Attri...