Bug 44472 - The inclusion of an XML comment at top of linker input thwarts linking
Summary: The inclusion of an XML comment at top of linker input thwarts linking
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: 4.6.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2016-09-19 02:03 UTC by Kent
Modified: 2017-08-31 15:11 UTC (History)
6 users (show)

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

Test Case (11.33 KB, application/zip)
2016-09-20 04:38 UTC, Alex Soto [MSFT]

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 for Bug 44472 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Kent 2016-09-19 02:03:06 UTC
A linker configuration file that is being passed to monotouch via, e.g.


will be ignored/not applied if the XML includes comments before the opening <linker> element.

For example, this works:

<?xml version="1.0" encoding="UTF-8" ?>

  <assembly fullname="System">
    <type fullname="System.ComponentModel.NullableConverter">
      <method name=".ctor"/>
    <type fullname="System.ComponentModel.ReferenceConverter">
      <method name=".ctor"/>

But this does not:

<?xml version="1.0" encoding="UTF-8" ?>

<!-- foo -->

  <assembly fullname="System">
    <type fullname="System.ComponentModel.NullableConverter">
      <method name=".ctor"/>
    <type fullname="System.ComponentModel.ReferenceConverter">
      <method name=".ctor"/>
Comment 1 Alex Soto [MSFT] 2016-09-20 04:37:15 UTC
I am able to reproduce this issue using xamarin-macios/master @ e3863afb303b4c155c806ab3333b791f40fac4ab (latest commit at the date posting this)

I've created a test case with two linker xml files, one using comments (linkerWithComments.xml) and the other not using comments (linkerNoComments.xml)

In order to use the test case you should run the attached test case in Debug/Simulator, right now it is configured to use "linkerWithComments.xml" and linker behaviour set to "Link SDK Only" reproducing the described issue in comment #0 if run as is.

Build log using linkerWithComments.xml: (FAILS :()

Build log using linkerNoComments.xml: (WORKS!!)

The test case is simple, we try to get the type and create an instance using reflection.

@Sebastien rings a bell?
Comment 2 Alex Soto [MSFT] 2016-09-20 04:38:20 UTC
Created attachment 17607 [details]
Test Case
Comment 3 Sebastien Pouliot 2016-09-20 13:44:58 UTC
This is a general mono linker issue that needs to be fixed in mono (so it gets fixed in all products).
Comment 4 Marek Safar 2017-08-31 15:11:45 UTC
Please report linker issues at https://github.com/mono/linker