Bug 59106 - comment inside type tag broke linker
Summary: comment inside type tag broke linker
Status: NEEDINFO
Alias: None
Product: Android
Classification: Xamarin
Component: Linker (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2017-08-30 03:23 UTC by Eric Liu
Modified: 2017-10-05 15:32 UTC (History)
3 users (show)

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


Attachments
comment in xml breaks mono linker (1.27 KB, text/plain)
2017-08-30 18:03 UTC, Eric Liu
Details

Description Eric Liu 2017-08-30 03:23:47 UTC
<?xml version="1.0" encoding="utf-8" ?>
<linker>
  <assembly fullname="assembly">
    <type fullname="type" >
      <!--comment-->
    </type>
  </assembly>
</linker>

adding the comment line is breaking the linker
Comment 1 Jon Douglas [MSFT] 2017-08-30 05:08:42 UTC
Hi Eric,

First off, thanks for the bug report. We really appreciate you taking the time and effort to file this issue.

With regards to your report, can you please provide a reproducible case in which this demonstrates a comment line causing the LinkAssemblies Task to fail? The item you have copied will fail on the first <assembly> line because "assembly" is not an actual assembly name. For investigation purposes, we would need a valid test case. You can attach a reproduction project, or provide reproduction steps with code snippets!

I took a quick look into the source:

https://github.com/mono/linker/tree/master/linker (lots of great documentation here)

and

https://github.com/mono/linker/blob/master/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs

I then tested a simple type such as:

<?xml version="1.0" encoding="utf-8" ?>
<linker>
  <assembly fullname="System.Core">
    <type fullname="System.Threading.ReaderWriterLockSlim" >
      <!--comment-->
    </type>
  </assembly>
</linker>

Which seems to build just fine. Thus it seems the linker has no problems with XML comments. Let me know what you find out on your end. Thanks again!
Comment 2 Eric Liu 2017-08-30 18:03:44 UTC
Created attachment 24486 [details]
comment in xml breaks mono linker

Sorry, forgot to add attachment.

[ working case ]:
<type fullname="System.Linq.AsyncEnumerable" >
</type>

this option not stripping AsyncEnumerable

[ non-working case ]:
<type fullname="System.Linq.AsyncEnumerable" >
      <!--comment-->
</type>

this option with comment still stripping out AsyncEnumerable, so basically I think the linker somehow thinks there is only 1 child in type to exclude from linking, but it's a comment
Comment 3 Eric Liu 2017-08-30 18:07:15 UTC
I'm aware about the mono linker, but I don't have time to dig it out.

Note You need to log in before you can comment on or make changes to this bug.