Bug 35331 - Linker fails if set to 'Link SDK assemblies only' mode (Error MSB4018)
Summary: Linker fails if set to 'Link SDK assemblies only' mode (Error MSB4018)
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 5.1
Hardware: PC Windows
: Normal normal
Target Milestone: 6.1 (C7)
Assignee: Radek Doulik
URL: http://forums.xamarin.com/discussion/...
Depends on:
Reported: 2015-10-28 12:31 UTC by Tibor Ebner
Modified: 2016-02-08 14:15 UTC (History)
6 users (show)

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

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:

Comment 4 Tibor Ebner 2015-10-28 12:47:16 UTC
Please find the public Xamarin Forums discussion of the bug at the URL.
Comment 7 Radek Doulik 2015-11-05 11:06:52 UTC
Tibor, could you please attach whole project or simplified version, which reproduces the issue?

I have already tried to use the assemblies from the build folder, but looks like cecil doesn't have problem reading and writing them.

Could you try the Xamarin Android from alpha channel to see if it happens in version 6.x as well?
Comment 10 Radek Doulik 2015-11-06 08:38:03 UTC
OK, the problem is caused by broken otp.dll assembly. The method

System.Void Otp.AbstractConnection::cookieError(Otp.OtpLocalNode,Otp.Erlang.Atom)

contains leave instruction with target outside of method boundaries. I guess it should have point to the ending ret IL, which is missing? This is the end of the method:

      catch [mscorlib]System.IO.IOException 
        IL_00ed:  pop
        IL_00ee:  nop
        IL_00ef:  nop
        IL_00f0:  leave      IL_00f5

      }  // end handler
      IL_00f5:  nop
      IL_00f6:  leave      IL_0118

    }  // end .try
      IL_00fb:  nop
      IL_00fc:  ldarg.0
      IL_00fd:  callvirt   instance void Otp.AbstractConnection::close()
      IL_0102:  ldstr      "Remote cookie not authorized: "
      IL_0107:  ldarg.2
      IL_0108:  callvirt   instance string Otp.Erlang.Object::atomValue()
      IL_010d:  call       string [mscorlib]System.String::Concat(string,
      IL_0112:  newobj     instance void Otp.OtpAuthException::.ctor(string)
      IL_0117:  throw
    }  // end handler
  } // end of method AbstractConnection::cookieError

problematic instruction:

      IL_00f6:  leave      IL_0118

I will look into how to make cecil work with that.

If you can get fixed otp.dll meanwhile, it should fix the issue in your build.
Comment 11 Tibor Ebner 2015-11-06 09:46:53 UTC
I'll see if I can fix the third-party opt.dll. Anyway, thanks a lot, Radek!
Comment 13 Radek Doulik 2016-02-08 13:34:33 UTC
this is fixed by de0c7ddb42f9a9541a5160764c3dd69889b330d7