Bug 33124 - Incorrect .mdb files cause linker errors
Summary: Incorrect .mdb files cause linker errors
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.11 (C5)
Hardware: Macintosh Mac OS
: Highest critical
Target Milestone: 3.11.x (iOS9)
Assignee: Bugzilla
: 33964 34063 ()
Depends on:
Blocks: 34130
  Show dependency tree
Reported: 2015-08-14 18:34 UTC by James Van Noord
Modified: 2015-09-24 09:28 UTC (History)
26 users (show)

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

XS project which shows the linker error described in the Description. (83.00 KB, application/zip)
2015-08-14 18:34 UTC, James Van Noord
Test case, minimal (15.24 KB, application/zip)
2015-09-18 17:39 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 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:

Description James Van Noord 2015-08-14 18:34:11 UTC
Created attachment 12514 [details]
XS project which shows the linker error described in the Description.

Attached is a zip file containing a project that succeeds when built with XS 5.9.5 + Xamarin.iOS, but fails the linker step when built with XS 5.9.5 (build 17) + Xamarin.iOS

My current setup:

=== Xamarin Studio ===

Version 5.9.5 (build 17)
Installation UUID: bb12c0a1-844d-4ace-bbe9-508629c49e9a
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Apple Developer Tools ===

Xcode 7.0 (8190.6)
Build 7A176x

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 2628f96
Branch: master
Build date: 2015-08-09 22:08:44-0400

=== Build Information ===

Release ID: 509050017
Git revision: 7d17e84374f953da1c64d66d75fc651520528e6e
Build date: 2015-07-21 20:36:20-04
Xamarin addins: 45b520f604ef71d1ad2cd3756544d45dac93867e

=== Operating System ===

Mac OS X 10.10.4
Darwin ws1799.lrscorp.net 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 James Van Noord 2015-08-31 15:50:03 UTC
This linker error is still a problem with Xamarin.iOS

=== Xamarin Studio ===

Version 5.9.5 (build 18)
Installation UUID: bb12c0a1-844d-4ace-bbe9-508629c49e9a
	Mono 4.2.0 (explicit/a224653)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402000179

=== Apple Developer Tools ===

Xcode 7.0 (8208.9)
Build 7A192o

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 52034fb
Branch: master
Build date: 2015-08-26 23:50:57-0400

=== Build Information ===

Release ID: 509050018
Git revision: e9148b1cfc781f8e7751f88540c6d65cca5be410
Build date: 2015-08-24 11:44:21-04
Xamarin addins: 3b908d565411f1a7425b67926ede4359e7000172

=== Operating System ===

Mac OS X 10.10.5
Darwin ws1799.lrscorp.net 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-09-01 06:21:42 UTC
This is the build error:

> Linking SDK only for assembly /Users/rolf/Downloads/TestApp/TestApp/bin/iPhoneSimulator/Debug//TestApp.exe into /Users/rolf/Downloads/TestApp/TestApp/obj/iPhoneSimulator/Debug/mtouch-cache/PreBuild
> MTOUCH: error MT2001: Could not link assemblies. Reason: Can't not find the nested type '<<.ctor>b__2c>d__34' in 'Cirrious.MvvmCross.Plugins.DownloadCache.MvxFileDownloadCache/Timer/<>c__DisplayClass2f

full build log: https://gist.github.com/rolfbjarne/d2a01e6d39c7b44b8e4e
Comment 3 James Van Noord 2015-09-10 19:33:45 UTC
This issue persists in Xamarin.iOS
Comment 4 Todd Diehl 2015-09-11 15:01:24 UTC
We were able to work around the problem by recompiling the 3.5.1 MvvmCross DownloadCache source with Mono, which generates slightly different types.

    ➜  (from nuget) monop -p -r:Cirrious.MvvmCross.Plugins.DownloadCache.dll.orig|grep Timer
    ➜  (built with mono) monop -p -r:Cirrious.MvvmCross.Plugins.DownloadCache.dll|grep Timer
Comment 5 Jelle 2015-09-17 11:23:41 UTC
Any news on this issue? When can we expect a fix?
Comment 6 Sebastien Pouliot 2015-09-18 15:02:24 UTC
The issue seems to be with the .mdb file (copied from VS to the Mac). A release builds works fine.
Comment 7 Sebastien Pouliot 2015-09-18 15:14:29 UTC
*** Bug 33964 has been marked as a duplicate of this bug. ***
Comment 8 Sebastien Pouliot 2015-09-18 15:18:28 UTC
*** Bug 34063 has been marked as a duplicate of this bug. ***
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-18 17:39:30 UTC
Created attachment 12970 [details]
Test case, minimal

Just on the small chance it might be useful at some point over the course of this bug's life, the following class is sufficient to reproduce the problem (when it is compiled by Microsoft's C# 5 (VS 2013) `csc.exe` compiler):

> public class Class1
> {
>     public Class1()
>     {
>         Action x = async () => { };
>     }
> }

The attached test case includes a `csc`-compiled version of this class in `UnifiedSingleViewIphone1/lib/PortableClassLibrary1.dll`

## Steps to reproduce

> $ xbuild /t:Build /p:Platform="iPhone" /p:Configuration="Release" PortableClassLibrary1.sln

(You could build on Windows instead if you wanted, but since `PortableClassLibrary1.dll` is pre-compiled, it is sufficient to build the solution on Mac.)

## Regression status: regression in Xamarin.iOS 9.0

BAD:  Xamarin.iOS  (xcode7-c5: d230615)
GOOD: Xamarin.iOS (6757279)
Comment 13 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-18 19:42:55 UTC
The Xamarin developers are creating a follow-up build to fix this issue that will be released within the next few days.

(Small additional side note to users seeing this issue with libraries other than MvvmCross: the workaround from comment 4 is only possible if you have the source code of the library that causes the problem. There are almost certainly some closed source NuGet packages and Components that are affected by this issue. The workaround from comment 4 will not be possible with those libraries. Apart from disabling the linker entirely (which will not be suitable for App Store submissions) or downgrading, no general workarounds are known at this time.)
Comment 16 chris 2015-09-21 04:34:30 UTC
Is there a release date for 

I can't see it on the Beta or Stable channels. The latest version available is
Comment 17 Zach Green 2015-09-21 08:22:58 UTC
Is there any additional information about a possible work around. My application is broken in iOS 9, but I cannot build my app with the linker turned on to submit a fixed version.

Please give an ETA of the release or a workaround. This is a major bug.
Comment 18 Kevin Cherdch 2015-09-21 14:52:17 UTC
Upgrading to VS 2015 works fine. The catch is if the solution has any shared projects, it may complain about the MSBuild/v14.0.0/8.1/Microsoft.Windows.UI.Xaml.CSharp.targets not found. If that's the case, then just have to copy from v12.0.0/8.1 over and it should work as normal.
Comment 19 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-21 15:03:31 UTC
## Draft development build with a fix available via contact@xamarin.com

The Xamarin.iOS team has now created a draft development build that reverts the change that caused this problem. For anyone who would like access to this draft build, please send an email to contact@xamarin.com and refer to Bug 33124.

This draft build is under review by the engineering and QA teams to assess whether it is suitable for publication on the Stable updater channel. If all goes according to plan, it will be available on the Stable channel before the end of the week.
Comment 20 Zach Green 2015-09-21 15:15:40 UTC
Thanks Brendan. I got a copy of the build earlier, and I am not able to build with the linker turned on.
Comment 21 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-21 15:18:28 UTC
For anyone who tries the new build and hits problems, please follow-up with the Support Team via email. You can use contact+xamarinios9.0@xamarin.com or one of the email addresses listed on https://store.xamarin.com/account/my/subscription.

Thanks in advance!
Comment 22 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-24 09:28:03 UTC
For bookkeeping, I will note that Xamarin.iOS (that includes the fix for this bug) has now been released to the Stable channel. See comment 21 for any further follow-up on this bug. Thanks!