I'm looking into PostSharp as a means to bring logging into my team's projects. I'm running into an error when I try to create a sample aspect. I have some room to debug it, but I'd like to get some thoughts on where I might look.
I installed PostSharp, and when I first reference the PS dlls from my project, I get this exception on build:
Unhandled exception: PostSharp.AssertionFailedException: Invalid image. The token TypeRefResolutionScopeColumn is null.
I'm running Visual Studio 2008 SP1 on Windows Server 2008 SP2, 64-bit. I installed PostSharp with the 1.0SP1 64-bit installer, then I restarted Visual Studio. When I brought my (C# library) project up again, it built successfully. When I added references to PostSharp.Laos and PostSharp.Public, and tried to build, I got the error. I modified PostSharp and my project in no other way.
I can add the references successfully to a new project (and I see the PS banner in the output), just not to any of my existing projects. I've started ripping pieces out of my project, but haven't cleared the error. I can continue down this path, but I'm not real sure where it leads, and I'd love to have a signpost. I haven't found any reference to this exception. Has anyone else run into this?
Here's the full dump from my build output:
PostSharp 1.0 [1.0.12.469] - Copyright (c) Gael Fraiteur, 2005-2008.
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : Unhandled exception: PostSharp.AssertionFailedException: Invalid image. The token TypeRefResolutionScopeColumn is null.
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.ModuleReader.ModuleReader.ImportTypeRefs()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.ModuleReader.ModuleReader.ReadModule()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions bindingOptions)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.CodeModel.TypeRefDeclaration.GetTypeDefinition()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.Tasks.CustomAttributeDictionaryTask.InternalAddAttribute(ICustomAttributeInstance attribute)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.Tasks.CustomAttributeDictionaryTask.Execute()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.Project.ExecutePhase(String phase)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.Project.Execute()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.Extensibility.PostSharpObject.InvokeProjects(ProjectInvocation[] projectInvocations)
C:\Program Files (x86)\PostSharp 1.0\PostSharp-1.0.targets(248,5): error : at PostSharp.MSBuild.PostSharpRemoteTask.Execute(PostSharpTaskParameters parameters, TaskLoggingHelper log)
Done building project "[redacted].csproj" -- FAILED.