Bug 29256 - [XI 8.10] AOT "error: invalid symbol redefinition" caused by certain uses of generic types in Visual Basic PCLs
Summary: [XI 8.10] AOT "error: invalid symbol redefinition" caused by certain uses of ...
Status: RESOLVED DUPLICATE of bug 28961
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: XI 8.10
Hardware: PC Mac OS
: --- normal
Target Milestone: 8.10
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-20 18:02 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-06-12 15:57 UTC (History)
2 users (show)

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


Attachments
Test case (29.44 KB, application/zip)
2015-04-20 18:02 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Log files (181.39 KB, application/zip)
2015-04-20 18:03 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Test case with the VB project already built (57.61 KB, application/zip)
2015-04-21 11:18 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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:
RESOLVED DUPLICATE of bug 28961

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-04-20 18:02:58 UTC
Created attachment 10828 [details]
Test case

AOT "error: invalid symbol redefinition" caused by certain uses of generic types in Visual Basic PCLs


Regression status: REGRESSION between Xamarin.iOS 8.9.1.3 (f7736a4) and Xamarin.iOS 8.10.0.258 (c2c0012)


This might be related to bug 28961. Perhaps it's even a duplicate.




## Steps to reproduce

1. Ensure Visual Studio is paired with the Mac build host so that the remote build phase will run.

2. Attempt to build the "ClassicSingleViewIphone1" project from the attached test case in the "Release|iPhone" configuration in Visual Studio.


Note: If you compile the VB.NET PCL on Windows beforehand, then you can replace the VB.NET PCL project reference in "CSPortableLibrary2" with a `.dll` reference, and then you'll be able to reproduce the problem on OS X using `xbuild`. So, because this problem is not strictly limited to the XamarinVS extensions, I am filing it directly under "iOS" rather than "XamarinVS."




## Results on XI 8.10.0.258 (c2c0012) (Bad)

The build fails during AOT compilation due to a "symbol redefinition" in one of the `.s` files.


### From `~/Library/Logs/Xamarin/MonoTouchVS/ClassicSingleViewIphone1_*.log`

> [20-Apr-2015 16:54:47] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
>   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk
>   -Qunused-arguments -miphoneos-version-min=7.0 -arch armv7 -c 
>   -o /Volumes/Cases/macuser/Library/Caches/Xamarin/mtbs/builds/ClassicSingleViewIphone1/0ebb50b60640f982b1bf022bd3eafa79/obj/iPhone/Release/mtouch-cache/CSPortableLibrary2.dll.armv7.o
>   -x assembler
>   /Volumes/Cases/macuser/Library/Caches/Xamarin/mtbs/builds/ClassicSingleViewIphone1/0ebb50b60640f982b1bf022bd3eafa79/obj/iPhone/Release/mtouch-cache/CSPortableLibrary2.dll.armv7.s
> [20-Apr-2015 16:54:47] /Volumes/Cases/macuser/Library/Caches/Xamarin/mtbs/builds/ClassicSingleViewIphone1/0ebb50b60640f982b1bf022bd3eafa79/obj/iPhone/Release/mtouch-cache/CSPortableLibrary2.dll.armv7.s:318:1: error: invalid symbol redefinition
> [20-Apr-2015 16:54:47] plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler:


### `CSPortableLibrary2.dll.armv7.s` does indeed contain multiple definitions for this symbol

> $ grep VBPortableLibrary1_ObjectProperty_add_ValueChanged /Volumes/Cases/macuser/Library/Caches/Xamarin/mtbs/builds/ClassicSingleViewIphone1/0ebb50b60640f982b1bf022bd3eafa79/obj/iPhone/Release/mtouch-cache/CSPortableLibrary2.dll.armv7.s
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler:
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler:
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler:

There are 3 re-definitions of the symbol, one for each `ValueChanged += ...` line in `CSPortableLibrary2.Class1`.




## Results after replacing VB PCL with C# PCL

The test case includes a fairly literal line-by-line port of the VB PCL to C#. Switching "CSPortableLibrary2" to reference this C# project does seem to stop the problem, so the problem might be particular to the IL format of Visual Basic PCLs.




## Results on XI 8.9.1.3 (f7736a4) (Good)

> $ grep VBPortableLibrary1_ObjectProperty_add_ValueChanged obj/iPhone/Release/mtouch-cache/CSPortableLibrary2.dll.armv7.s 
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler:
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler_0
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler_0:
> 	.no_dead_strip plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler_1
> plt_VBPortableLibrary1_ObjectProperty_add_ValueChanged_VBPortableLibrary1_ObjectProperty_ValueChangedEventHandler_1:

Each re-definition has an extra number appended to the name, preventing any conflict.




## Version information

### Windows 8.1 64-bit, in VMWare Fusion 6.0.5 (2209127)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.11.431.0 (3673cfb)
Xamarin.iOS   8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)


### OS X 10.9.5, MacBook Air

Xamarin.iOS, 8.10.0.258 (Business Edition)
Hash: c2c0012
Branch: master
Build date: 2015-04-14 17:26:21-0400

Mono 4.0.0 (detached/d136b79)

Xcode 6.2 (6776), Build 6C131e
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-04-20 18:03:44 UTC
Created attachment 10829 [details]
Log files
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-04-21 04:38:37 UTC
@Brendan, can you attach a binary version of that VB PCL dll, so that I can to reproduce on Mac?
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-04-21 11:18:12 UTC
Created attachment 10841 [details]
Test case with the VB project already built

Sure thing. For convenience, I also made the other small adjustments needed to use the VB `.dll` rather than the VB project, and I reattached the whole test case.


The test case attached in this comment can now be built on either Mac or Windows to hit the error.

For example:
> $ xbuild /t:Build /p:Configuration=Release /p:Platform=iPhone ClassicSingleViewIphone1.sln



Note: the old `mdtool` tasks hit the same error as the new MSBuild tasks, so you can use whichever one you prefer.
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-04-21 11:19:49 UTC
Updating status to NEW per comment 4.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2015-04-23 07:27:18 UTC
This has already been fixed in master.

*** This bug has been marked as a duplicate of bug 28961 ***