postsharp

Cannot use PostSharp with .NET 4.6.2

时光怂恿深爱的人放手 提交于 2020-01-04 07:31:28
问题 I am using PostSharp and have just upgraded my solution to .NET 4.6.2 After installing the package System.ValueTuple I get a BindingException: Ambiguous assembly binding policies exception in the output when trying to build the main project with PostSharp enabled. Unhandled exception (4.3.30.0, postsharp-net40-x86-srv.exe, CLR 4.0.30319.394802, Release): PostSharp.Sdk.CodeModel.BindingException: Ambiguous assembly binding policies: Assembly 'system.runtime, version=4.0.0.0, culture=neutral,

PostSharp - How to inject a method into a class?

寵の児 提交于 2020-01-02 09:38:08
问题 I have some problem with PostSharp (I assume that problem can be solved by other library). I have that scenario: I must get all classes with name containing a word, e.g "Sth". I have that classes in my project (an example): SthClass1.cs SthClassBlabla.cs SthClass3.cs and I find that classes using PostSharp : [assembly: TraceAttribute( AttributeTargetMembers = "Sth*")] then, is it possible to inject (using aspect, PostSharp (?)) code for each found class ? example: SthClass1 myObj = new

Is there a way in Log4Net or NLog (or some other logger) to output logs in an execution-stack-nested XML or JSON format?

☆樱花仙子☆ 提交于 2020-01-02 03:41:26
问题 Is there a way in Log4Net or NLog (or some other logger) to output logs in an execution-stack-nested XML or JSON format, such that if function A() calls B(7) that calls C("something") , it'll output something like: <Method name="A"> <Method name="B" params="(int) 7"> <Method name="C" params="(string) 'something'"/> </Method> </Method> or even better: <Method name="A"> <Method name="B" params="(int) 7"> <Params> <int>7</int> </Params> <Method name="C"> <Params> <string>something</string> <

Filtering log4net on method name - can't quite get it

别来无恙 提交于 2020-01-02 03:13:09
问题 I'm using log4net to log my web app's progress, using Log4PostSharp to AOP-injectify all methods. This has the desired effect of logging (almost) everything and is fine. I now have a requirement to log JUST Page_Load methods to a file / console. I can obviously hamstring the log4postsharp class to do that, but then I'd be losing all the other logging. I've been looking at filters in log4net, starting with the StringMatch filter, but that only looks at the message being logged, and I'm after

How can i use simple aspect oriented concept to handle exception handling without postsharp?

白昼怎懂夜的黑 提交于 2020-01-01 07:36:18
问题 i want to use AOP to handle my error exception in Console application. ( it is not MVC i used attribute vase programing to handle errors in mvc but this is console app) My code below: ( if error occurs ,it should throw an error yo my attribute side code ) [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class HandleError : Attribute { public HandleError(string description) { try { this.Description = description; } catch (Exception) { throw; } } public

Which Tools Perform Post-Compile Modification of IL?

我只是一个虾纸丫 提交于 2020-01-01 03:41:12
问题 A recent mention of PostSharp reminded me of this: Last year where I worked, we were thinking of using PostSharp to inject instrumentation into our code. This was in a Team Foundation Server Team Build / Continuous Integration environment. Thinking about it, I got a nagging feeling about the way PostSharp operates - it edits the IL that is generated by the compilers. This bothered me a bit. I wasn't so much concerned that PostSharp would not do its job correctly; I was worried about the fact

pdb file is mising after PostSharp

拥有回忆 提交于 2019-12-30 17:27:11
问题 I am using PostSharp version 2.1.6.4 (also tried latest version 2.1.7.35) and sometimes pdb file is missing and there is a pssym file in it's place. <?xml version="1.0" encoding="utf-8"?> <Symbols xmlns="http://schemas.postsharp.org/2.0/symbols"> <Class Class="#1=T:[CrosscuttingLogging]CrosscuttingLogging.Attributes.LogMethodCallStatsAttribute" LimitedLicense="true" /> <Class Class="#2=T:[RequestLimiter]RequestLimiter.RequestCounterAttribute" LimitedLicense="true" /> </Symbols> I ran procmon

issue with PostSharp cannot find assembly for system.web.mvc, version=3.0.0.0 when no projects reference it

对着背影说爱祢 提交于 2019-12-30 08:25:16
问题 I'm using PostSharp, and this was working fine. Recently, we upgraded some projects to the MVC version 5.2. Today, I loaded up an old project which was using version 4.0 of MVC. PostSharp started reporting a strange error on build: Error 17 Unhandled exception (3.1.42.0, 32 bit, CLR 4.5, Release): PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot find assembly 'system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. [Version mismatch] ============ PostSharp

Postsharp: how does it work?

人盡茶涼 提交于 2019-12-30 07:05:08
问题 Following the advice got on another question of mine, I converted the code there quoted to be used with PostSharp: Attribute: [Serializable] public sealed class InitAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionEventArgs eventArgs) { Console.Write("Works!"); } } static class Logger { public static string _severity; public static void Init(string severity) { _severity = severity; } [Init()] public static void p() { Console.WriteLine(_severity); } } Still, I

INotifyPropertyChanged-Feature on Auto-Properties

眉间皱痕 提交于 2019-12-25 03:16:00
问题 I have many Model-Classes which implement the INotifyPropertyChanged-Interface in order to update the UI when value changed. Sadly the properties must be written fully to support this feature. I decreased my code already by using the 'SetPropertyValue'-Method() in BaseClass. private string _title; public string Title { get { return title; } set { SetPropertyValue("Title", ref _title, value ); } } But with 20 properties written like that in one file it is not so simple to understand the