Bug 28198 - The "LinkAssemblies" task failed unexpectedly
Summary: The "LinkAssemblies" task failed unexpectedly
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.20.0
Hardware: PC Mac OS
: High normal
Target Milestone: 5.1.1 (C5SR1)
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2015-03-19 11:12 UTC by Prashant Cholachagudda
Modified: 2015-04-30 07:46 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
updated test case (1.34 MB, application/zip)
2015-04-09 11:10 UTC, Radek Doulik
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Prashant Cholachagudda 2015-03-19 11:12:54 UTC
Building an Android app in release mode fail with following exception

Error 36 The "LinkAssemblies" task failed unexpectedly.
System.NotImplementedException: Void
at Mono.Cecil.SignatureReader.GetPrimitiveType(ElementType etype)
at Mono.Cecil.SignatureReader.ReadCustomAttributeFieldOrPropType()
at Mono.Cecil.SignatureReader.ReadCustomAttributeNamedArgument(Collection`1& fields, Collection`1& properties)
at Mono.Cecil.SignatureReader.ReadCustomAttributeNamedArguments(UInt16 count, Collection`1& fields, Collection`1& properties)
at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
at Mono.Cecil.CustomAttribute.<Resolve>m__1(CustomAttribute attribute, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.CustomAttribute.Resolve()
at Mono.Cecil.CustomAttribute.get_HasConstructorArguments()
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
at Mono.Linker.Steps.MarkStep.MarkFields(TypeDefinition type, Boolean includeStatic)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
at Mono.Linker.Steps.MarkStep.MarkFields(TypeDefinition type, Boolean includeStatic)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
at Mono.Linker.Steps.MarkStep.InitializeFields(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1017 6 AndroidApplication1

## Complete Build log - https://www.dropbox.com/s/ugfe1x55c1492jv/build.log?dl=0
Comment 4 Radek Doulik 2015-04-02 17:15:17 UTC
The problem here is a broken Synergex.SynergyDE.ddlib.dll which contains custom attribute instances with property or field of void type.

I will check whether we can somehow workaround that, so that the linker doesn't break.
Comment 5 Radek Doulik 2015-04-07 17:34:12 UTC
I have updated cecil to handle such assemblies. The problem was that the NumNamed in the custom attribute signature is wrong (7 instead of 6).

The problem is now fixed in the monodroid master branch by commit

d497763939ed5e15816befa62c0790d2b7728eac

and in cecil by commit

a6eec3e8cb2cf240126b7f744b2a31b59e477c44
Comment 6 Radek Doulik 2015-04-09 11:10:53 UTC
Created attachment 10686 [details]
updated test case

reference the problematic assemblies in the project itself, so that the bug can be reproduced even after cleaning the project. also strip down the size by removing unused files
Comment 7 Ram Chandra 2015-04-30 07:46:54 UTC
I have checked this issue with test case attached in comment 6 and I am able to reproduce  this issue with following builds:

Mac OS X 10.10.3
Xamarin.Android: 4.20.2.1 (Enterprise Edition)
Xamarin Studio : 5.8.4 (build 0)
Mono 3.12.1 ((detached/0849ec7)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312010003

Screencast: http://www.screencast.com/t/2iH4a9Qf8

To verify this issue I have checked this issue with following builds:

Mac OS X 10.10.3
Xamarin Studio: 5.9 (build 439)
Xamarin.Android: 5.1.0.122
Runtime: 
Mono 4.0.1 ((detached/72e497f)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000021
Xamarin.Android: 5.1.0.122 (Enterprise Edition)
=== Build Information ===
Release ID: 509000439
Git revision: cec8c06f27b7ed21b432be86f92ad1ff45a7a7b7
Build date: 2015-04-29 11:56:17-04
Xamarin addins: df9b5918c9f7aca6da509fe3e5a62553aa101910

I have checked this issue with both configuration i.e. Debug and Release and observed that now I am not getting any build error when I try to build and run the attached project in comment 6.

Screencast: http://www.screencast.com/t/Of7cnRIGOM

This issue has been fixed.