Strange postsharp error on build
8 posts • Page 1 of 1
Strange postsharp error on build
I'm using postsharp by explicitly importing the postsharp targets into my csproj file:
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\..\Tools\PostSharp\PostSharp.targets" />
When I build the project, I get the following error from the PostSharp task:
Unhandled Exception: An item with the same key has already been added. See below for details.
The PostSharp build step failed (exit code 12). See previous errors or the build log for details.
The build log shows the following:
EXEC : error : Unhandled exception: An item with the same key has already been added. See below for details.
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(KeyValuePair`2 keyValuePair)
at PostSharp.Collections.Index`2.Add(TValue item)
at PostSharp.CodeModel.Collections.ElementCollection`1.Add(ItemType item)
at PostSharp.ModuleReader.ModuleReader.ImportFieldRef(MetadataToken token, MetadataRow row, IMemberRefResolutionScope declaringType, BufferReader buffer)
at PostSharp.ModuleReader.ModuleReader.ImportMemberRefs()
at PostSharp.ModuleReader.ModuleReader.ReadModule(ReadModuleStrategy strategy)
at PostSharp.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading)
at PostSharp.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName)
at PostSharp.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
at PostSharp.CodeModel.TypeRefDeclaration.GetTypeDefinition()
at PostSharp.Extensibility.Tasks.TypeHierarchyTask.IndexType(TypeDefDeclaration type)
at PostSharp.Extensibility.Tasks.AnnotationRepositoryTask.InternalAddAnnotation(ICustomAttributeInstance attribute)
at PostSharp.Extensibility.Tasks.AnnotationRepositoryTask.Execute()
at PostSharp.Extensibility.Project.ExecutePhase(String phase)
at PostSharp.Extensibility.Project.Execute()
at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
at PostSharp.Extensibility.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
at PostSharp.Extensibility.CommandLineProgram.InternalMain(String[] args)
C:\code\Crossbow\Tools\PostSharp\PostSharp-1.5.targets(276,5): error : The PostSharp build step failed (exit code 12). See previous errors or the build log for details.
It had been building succesfully yesterday; I'm not sure what happened to introduce this problem. What could be causing this exception?
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\..\Tools\PostSharp\PostSharp.targets" />
When I build the project, I get the following error from the PostSharp task:
Unhandled Exception: An item with the same key has already been added. See below for details.
The PostSharp build step failed (exit code 12). See previous errors or the build log for details.
The build log shows the following:
EXEC : error : Unhandled exception: An item with the same key has already been added. See below for details.
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(KeyValuePair`2 keyValuePair)
at PostSharp.Collections.Index`2.Add(TValue item)
at PostSharp.CodeModel.Collections.ElementCollection`1.Add(ItemType item)
at PostSharp.ModuleReader.ModuleReader.ImportFieldRef(MetadataToken token, MetadataRow row, IMemberRefResolutionScope declaringType, BufferReader buffer)
at PostSharp.ModuleReader.ModuleReader.ImportMemberRefs()
at PostSharp.ModuleReader.ModuleReader.ReadModule(ReadModuleStrategy strategy)
at PostSharp.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading)
at PostSharp.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName)
at PostSharp.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
at PostSharp.CodeModel.TypeRefDeclaration.GetTypeDefinition()
at PostSharp.Extensibility.Tasks.TypeHierarchyTask.IndexType(TypeDefDeclaration type)
at PostSharp.Extensibility.Tasks.AnnotationRepositoryTask.InternalAddAnnotation(ICustomAttributeInstance attribute)
at PostSharp.Extensibility.Tasks.AnnotationRepositoryTask.Execute()
at PostSharp.Extensibility.Project.ExecutePhase(String phase)
at PostSharp.Extensibility.Project.Execute()
at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
at PostSharp.Extensibility.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
at PostSharp.Extensibility.CommandLineProgram.InternalMain(String[] args)
C:\code\Crossbow\Tools\PostSharp\PostSharp-1.5.targets(276,5): error : The PostSharp build step failed (exit code 12). See previous errors or the build log for details.
It had been building succesfully yesterday; I'm not sure what happened to introduce this problem. What could be causing this exception?
- glennburnside
- Posts: 5
- Joined: Mon Jul 28, 2008 7:24 pm
- First Name: Glenn
- Last Name: Burnside
- Company: Dell, Inc.
Re: Strange postsharp error on build
To add some more detail to this that I just discovered:
I can make that PostSharp error go away by removing one class in particular, which is a custom test fixture class in an mbunit-based test framework. Even further, if I remove the SetUp and TearDown attributes on that class' Setup and Teardown public methods, the error goes away. Any thoughts on what it is about those two attributes that could be causing that PostSharp error?
I can make that PostSharp error go away by removing one class in particular, which is a custom test fixture class in an mbunit-based test framework. Even further, if I remove the SetUp and TearDown attributes on that class' Setup and Teardown public methods, the error goes away. Any thoughts on what it is about those two attributes that could be causing that PostSharp error?
- glennburnside
- Posts: 5
- Joined: Mon Jul 28, 2008 7:24 pm
- First Name: Glenn
- Last Name: Burnside
- Company: Dell, Inc.
Re: Strange postsharp error on build
I would say that some assembly is not compliant to ECMA specs.
What assemblies are linked to your?
What assemblies are linked to your?
Gael Fraiteur, project leader
- gfraiteur
- Site Admin
- Posts: 835
- Joined: Tue Dec 18, 2007 3:09 pm
- First Name: Gael
- Last Name: Fraiteur
- Company: postsharp.org
Re: Strange postsharp error on build
Here's everything that project is linking:
Gallio
MbUnit
PostSharp.Laos
PostSharp.Public
System
System.configuration
System.Core
System.Data
System.Drawing
System.Web
System.Xml
WatiN.Core
...and I'm using PostSharp 1.5 CTP. Should I maybe try using the 1.0RC4 instead?
Gallio
MbUnit
PostSharp.Laos
PostSharp.Public
System
System.configuration
System.Core
System.Data
System.Drawing
System.Web
System.Xml
WatiN.Core
...and I'm using PostSharp 1.5 CTP. Should I maybe try using the 1.0RC4 instead?
- glennburnside
- Posts: 5
- Joined: Mon Jul 28, 2008 7:24 pm
- First Name: Glenn
- Last Name: Burnside
- Company: Dell, Inc.
Re: Strange postsharp error on build
Any idea which assembly the problem occurs with?
If you use the debugger and break at the exception, then look at the stack frame
PostSharp.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading)
It is the parameter reflectionAssembly.
-Gael
If you use the debugger and break at the exception, then look at the stack frame
PostSharp.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading)
It is the parameter reflectionAssembly.
-Gael
Gael Fraiteur, project leader
- gfraiteur
- Site Admin
- Posts: 835
- Joined: Tue Dec 18, 2007 3:09 pm
- First Name: Gael
- Last Name: Fraiteur
- Company: postsharp.org
Re: Strange postsharp error on build
I'm not sure how I'd break in to the debugger on an exception getting thrown from postsharp.exe getting invoked by msbuild getting invoked visual studio - but I was able to reproduce the error with the attached solution. I had to strip out the referenced assemblies to get around the file upload limitation on the bulletin board, but maybe you can use it to reproduce the error?
Thanks,
Glenn Burnside
Thanks,
Glenn Burnside
You do not have the required permissions to view the files attached to this post.
- glennburnside
- Posts: 5
- Joined: Mon Jul 28, 2008 7:24 pm
- First Name: Glenn
- Last Name: Burnside
- Company: Dell, Inc.
Re: Strange postsharp error on build
I filed the bug http://www.postsharp.org/tracker/view.php?id=243 and corrected it.
Gael Fraiteur, project leader
- gfraiteur
- Site Admin
- Posts: 835
- Joined: Tue Dec 18, 2007 3:09 pm
- First Name: Gael
- Last Name: Fraiteur
- Company: postsharp.org
Re: Strange postsharp error on build
Thank you so much - that fixed it!
- glennburnside
- Posts: 5
- Joined: Mon Jul 28, 2008 7:24 pm
- First Name: Glenn
- Last Name: Burnside
- Company: Dell, Inc.
8 posts • Page 1 of 1
