Bug 59160 - Follow-up to Bug 58711: the fix for non-public Bug 57889 is not yet included on xamarin-android/d15-4 branch
Summary: Follow-up to Bug 58711: the fix for non-public Bug 57889 is not yet included ...
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: Linker ()
Version: 8.0 (15.4)
Hardware: PC Mac OS
: High critical
Target Milestone: 15.4
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2017-08-31 22:06 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2017-09-01 00:06 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: Yes
Last known good build: d15-3 branch

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 INVALID

Description Brendan Zagaeski (Xamarin Team, assistant) 2017-08-31 22:06:17 UTC
Follow-up to Bug 58711: the fix for non-public Bug 57889 is not yet included on xamarin-android/d15-4 branch

This bug is to track getting the fix for non-public Bug 57889 included into the d15-4 branch.  Currently this second "half" of the fix (related to avoiding broken builds during linking due to mismatched debug symbols) is _not_ included on the d15-4 branch.

The fix made on mono/cecil/xamarin-android-d15-3 was:
https://github.com/mono/cecil/commit/82a2fe15984df2b697c42b2fef5ccc17370007e3


The current tip of xamarin-android/d15-4 is eca0e84:
https://github.com/xamarin/xamarin-android/tree/eca0e84ecbdbbfa85048f85c5a50317b5d67bf10/external

... brings us to Java.Interop 52559ef:
https://github.com/xamarin/java.interop/tree/52559ef47a6486449be54bbcf26741c41fe390f7/external

... brings us to Mono.Cecil 362e2bb:
https://github.com/mono/cecil/commits/362e2bb00fa693d04c2d140a4cd313eb82c78d95

The important thing for this bug is that the Mono.Cecil commit history does _not_ include the "do not set scope.Start when start_instruction is null" fix from non-public Bug 57889.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-09-01 00:06:28 UTC
Apologies.  The commit timestamps, order of commit locations, and commit messages misled me.  After reexamining the commits and explicitly testing the behavior, I am marking this bug as invalid.

Long story short, the follow-up fix for non-public Bug 57889 was a simplification of the fix for non-public Bug 57675.  It _replaced_ the original fix.  So only that _second_ version of the fix was needed in d15-4 (and later), and it was added in a _single_ commit.  I have replicated the problem on older versions and verified that is working correctly using the latest d15-4 version in my testing below.

Thanks!




## Steps followed to test

1. Extract the test case from Bug 58711, Comment 0.

2. Open the solution in Visual Studio for Mac to restore the NuGet packages.

3. Build the project in the Release configuration.

4. Add some little change to a source file like adding `var x = 1;` in the `MainActivity.OnCreate()` override. 

5. Build the project again in the Release configuration (without cleaning).




## GOOD results with Xamarin.Android 7.5.0-13 (d15-4/14c149)

There are no warnings or errors during the `LinkAssemblies` task.

(This Xamarin.Android build uses mono/cecil 362e2bb via java.interop and xamarin-android.)




## BAD results with Xamarin.Android 7.5.0-3 (d15-4/3e66e8e)

The build fails as described in Bug 58711.  Top of the call stack from the build output:

> error MSB4018: The "LinkAssemblies" task failed unexpectedly.
> error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void Xamarin.Forms.Platform.Android.ViewRenderer`2::set_Control(TNativeView)' in assembly: 'Xamarin.Forms.Platform.Android.dll' ---> System.ArgumentNullException: Value cannot be null.
> error MSB4018: Parameter name: instruction
> error MSB4018:   at Mono.Cecil.Cil.InstructionOffset..ctor (Mono.Cecil.Cil.Instruction instruction) [0x00021] in /Users/builder/data/lanes/5147/3e66e8e4/source/xamarin-android/external/Java.Interop/external/cecil/Mono.Cecil.Cil/Symbols.cs:200 
> error MSB4018:   at Mono.Cecil.Cil.CodeReader.ReadScope (Mono.Cecil.Cil.ScopeDebugInformation scope) [0x00015] in /Users/builder/data/lanes/5147/3e66e8e4/source/xamarin-android/external/Java.Interop/external/cecil/Mono.Cecil.Cil/CodeReader.cs:163 
> error MSB4018:   at Mono.Cecil.Cil.CodeReader.ReadScopes (Mono.Collections.Generic.Collection`1[T] scopes) [0x00004] in /Users/builder/data/lanes/5147/3e66e8e4/source/xamarin-android/external/Java.Interop/external/cecil/Mono.Cecil.Cil/CodeReader.cs:157 
> error MSB4018:   at Mono.Cecil.Cil.CodeReader.ReadScope (Mono.Cecil.Cil.ScopeDebugInformation scope) [0x000af] in /Users/builder/data/lanes/5147/3e66e8e4/source/xamarin-android/external/Java.Interop/external/cecil/Mono.Cecil.Cil/CodeReader.cs:180 
> error MSB4018:   at Mono.Cecil.Cil.CodeReader.ReadScopes (Mono.Collections.Generic.Collection`1[T] scopes) [0x00004] in /Users/builder/data/lanes/5147/3e66e8e4/source/xamarin-android/external/Java.Interop/external/cecil/Mono.Cecil.Cil/CodeReader.cs:157 

(This Xamarin.Android build uses mono/cecil c76ba7b via java.interop and xamarin-android.)




## BAD results with Xamarin.Android 7.4.0-17 (d15-3/ebbee99) (before the fix for non-public Bug 57889)

The build fails as described in non-public Bug 57889.  Top of the call stack from the build output:

> error MSB4018: The "LinkAssemblies" task failed unexpectedly.
> error MSB4018: System.NotSupportedException: Specified method is not supported.

(This Xamarin.Android build uses mono/cecil 16d2397 via java.interop and xamarin-android.)




## Additional testing environment info (brief)

Visual Studio 2017 for Mac (7.1.0.1297)
Mono MDK 5.2.0.215 (d15-3/da80840)

macOS 10.12.6