Does PostSharp add code during precompilation of assembly? -
when assembly using postsharp [log] aspect decompiled, decompiled code appeared without new code added it. doesn't postsharp add code corresponding aspect during precompilation?
postsharp post-processes compiler output reading , disassembling intermediate assembly, execute required transformations , validations, , rewriting final assembly disk.
postsharp integrates in build process via postsharp.targets. nuget adds postsharp.targets import project when install postsharp nuget package.
let's consider method:
[log] public void method() { }
if works correctly decompiled c# code of method starts (postsharp 5.0):
public void method() { bool flag = <>z__program.defaultcategory.isenabled(loglevel.debug); logmemberinfo logmemberinfo;
if don't see code, may indicate postsharp not correctly installed project or not correctly configured.
adding detailed logging solution article explains how correctly configure , add postsharp project.
Comments
Post a Comment