NullReferenceException while compiling

Technical questions about PostSharp Laos.

NullReferenceException while compiling

Postby Brettljausn on Thu Apr 24, 2008 4:18 pm

Hello,

I'm currently using PostSharp v.1.0.8.359 and everytime I compile the solution with the correct assembly name in the assembly attribute

<Assembly: AOP.MeasurePerformance(AttributeTargetAssemblies:="MyAssembly")>

I got the following NullReferenceException:

Code: Select all
Fehler   378   Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

Server stack trace:
   bei PostSharp.CodeWeaver.WeavingHelper.RestructureMethodBody(MethodDefDeclaration method, RestructureMethodBodyOptions options, InstructionWriter writer) in p:\branches\1.0\Core\PostSharp.Core\CodeWeaver\WeavingHelper.cs:Zeile 1021.
   bei PostSharp.CodeWeaver.Weaver.WeaveMethod(MethodDefDeclaration method) in p:\branches\1.0\Core\PostSharp.Core\CodeWeaver\Weaver.cs:Zeile 1522.
   bei PostSharp.CodeWeaver.Weaver.Weave() in p:\branches\1.0\Core\PostSharp.Core\CodeWeaver\Weaver.cs:Zeile 1066.
   bei PostSharp.CodeWeaver.WeaverTask.Execute() in p:\branches\1.0\Core\PostSharp.Core\CodeWeaver\WeaverTask.cs:Zeile 48.
   bei PostSharp.Extensibility.Project.ExecutePhase(String phase) in p:\branches\1.0\Core\PostSharp.Core\Extensibility\Project.cs:Zeile 1044.
   bei PostSharp.Extensibility.Project.Execute() in p:\branches\1.0\Core\PostSharp.Core\Extensibility\Project.cs:Zeile 1082.
   bei PostSharp.Extensibility.PostSharpObject.ExecuteProjects() in p:\branches\1.0\Core\PostSharp.Core\Extensibility\PostSharpObject.cs:Zeile 581.
   bei PostSharp.Extensibility.PostSharpObject.InvokeProjects(ProjectInvocation[] projectInvocations) in p:\branches\1.0\Core\PostSharp.Core\Extensibility\PostSharpObject.cs:Zeile 564.
   bei System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   bei System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
   bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   bei PostSharp.Extensibility.IPostSharpObject.InvokeProjects(ProjectInvocation[] projectInvocations)
   bei PostSharp.Extensibility.PostSharpObjectAccessor.InvokeProjects(ProjectInvocation[] projectInvocations) in p:\branches\1.0\Core\PostSharp.Core\Extensibility\PostSharpObjectAccessor.cs:Zeile 41.
   bei PostSharp.MSBuild.PostSharp.Execute() in p:\branches\1.0\Core\PostSharp.MSBuild\PostSharp.cs:Zeile 169.   xr5test


As soon as I use an assembly name that does not exist, the solution compiles successfully, but that way of course no aspect is applied. Same exception if I use other AttributeTargets (e.g. AttributeTargetTypesAttribute) with valid strings. However if I use the aspect as a method attribute, it works completely fine.

Any idea?

btw my aspect is inherited from the OnMethodBoundaryAspect class.

kind regards
Brettljausn
 
Posts: 1
Joined: Thu Apr 24, 2008 3:54 pm
Full Name: Horst Palme

Re: NullReferenceException while compiling

Postby gfraiteur on Thu Apr 24, 2008 7:01 pm

This is a bug, and it is related to the structure of the method to which it is applied.

The best would be to attach PostSharp to a debugger (using msbuild /p:PostSharpAttachDebugger=true) and tell me what is the value of the parameter 'method' of the method RestructureMethodBody on the top of the call stack, then send me a repro case containing this method. All that in a bug report.

Thanks!

Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 608
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org


Return to PostSharp Laos