Xamarin.forms: AndroidLinkMode=Full breaks <DataTemplate/> 4.0.0.135214-pre4

Created on 15 Feb 2019  路  6Comments  路  Source: xamarin/Xamarin.Forms

Description

Using the full linker strips something that is causing a crash at runtime:

02-15 10:55:16.831 28064 28064 F         : Xamarin.Forms.Xaml.DataTemplateExtension doesn't implement interface Xamarin.Forms.Internals.IDataTemplate
--------- beginning of crash
02-15 10:55:16.831 28064 28064 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 28064 (ex.forms.sample), pid 28064 (ex.forms.sample)
02-15 10:55:16.872 28099 28099 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
02-15 10:55:16.872   898   898 I /system/bin/tombstoned: received crash request for pid 28064
02-15 10:55:16.873 28099 28099 I crash_dump64: performing dump of process 28064 (target tid = 28064)
02-15 10:55:16.878 28099 28099 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-15 10:55:16.878 28099 28099 F DEBUG   : Build fingerprint: 'google/crosshatch/crosshatch:9/PQ1A.190105.004/5148680:user/release-keys'
02-15 10:55:16.878 28099 28099 F DEBUG   : Revision: 'MP1.0'
02-15 10:55:16.878 28099 28099 F DEBUG   : ABI: 'arm64'
02-15 10:55:16.878 28099 28099 F DEBUG   : pid: 28064, tid: 28064, name: ex.forms.sample  >>> com.companyname.glidex.forms.sample <<<
02-15 10:55:16.878 28099 28099 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
02-15 10:55:16.878 28099 28099 F DEBUG   : Abort message: 'Xamarin.Forms.Xaml.DataTemplateExtension doesn't implement interface Xamarin.Forms.Internals.IDataTemplate
02-15 10:55:16.878 28099 28099 F DEBUG   : '
02-15 10:55:16.878 28099 28099 F DEBUG   :     x0  0000000000000000  x1  0000000000006da0  x2  0000000000000006  x3  0000000000000008
02-15 10:55:16.878 28099 28099 F DEBUG   :     x4  8000000000000000  x5  8000000000000000  x6  8000000000000000  x7  0000000000000080
02-15 10:55:16.878 28099 28099 F DEBUG   :     x8  0000000000000083  x9  00000074238b7168  x10 fffffff87ffffbdf  x11 0000000000000001
02-15 10:55:16.878 28099 28099 F DEBUG   :     x12 0101010101010101  x13 0000000000000038  x14 ffffffffffffffff  x15 0000000000000018
02-15 10:55:16.878 28099 28099 F DEBUG   :     x16 00000074238f12c8  x17 000000742382edcc  x18 00000000029e73b6  x19 0000000000006da0
02-15 10:55:16.878 28099 28099 F DEBUG   :     x20 0000000000006da0  x21 000000738726a678  x22 0000007ffd7028e8  x23 0000007ffd7028e4
02-15 10:55:16.878 28099 28099 F DEBUG   :     x24 0000007ffd7028c8  x25 00000000ffffffff  x26 0000007ffd702958  x27 0000007ffd7028d8
02-15 10:55:16.878 28099 28099 F DEBUG   :     x28 0000000000000010  x29 0000007ffd702700
02-15 10:55:16.878 28099 28099 F DEBUG   :     sp  0000007ffd7026c0  lr  000000742382394c  pc  0000007423823974
02-15 10:55:16.878 28099 28099 F DEBUG   : 
02-15 10:55:16.878 28099 28099 F DEBUG   : backtrace:
02-15 10:55:16.878 28099 28099 F DEBUG   :     #00 pc 0000000000021974  /system/lib64/libc.so (abort+116)
02-15 10:55:16.878 28099 28099 F DEBUG   :     #01 pc 0000000000252e68  /data/app/com.companyname.glidex.forms.sample-3OqCEPF5qU0aXrYRLTdvfg==/lib/arm64/libmonosgen-2.0.so
02-15 10:55:16.984   898   898 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_06
02-15 10:55:16.986  1166  1234 I BootReceiver: Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
02-15 10:55:16.986  1166 28102 W ActivityManager:   Force finishing activity com.companyname.glidex.forms.sample/md599fb71691a7e1190aeeb73dc2b179786.MainActivity
02-15 10:55:16.992  1166  1223 I ActivityManager: Showing crash dialog for package com.companyname.glidex.forms.sample u0

I have XamlC enabled and have enabled Visual="Material".

Steps to Reproduce

  1. Clone this sample: https://github.com/jonathanpeppers/glidex/tree/master/glidex.forms.sample
  2. Remove <AndroidLinkSkip>Xamarin.Forms.Core</AndroidLinkSkip>
  3. Build/run this sample in release mode
  4. Navigation to one of the screens with a <ListView/>: ViewCell or ImageCell.
  5. See a crash at runtime

Expected Behavior

You shouldn't need to set $(AndroidLinkSkip) for Xamarin.Forms assemblies.

Actual Behavior

Use of ListView and <DataTemplate/> seem to require $(AndroidLinkSkip)

Basic Information

  • Version with issue: 4.0.0.135214-pre4
  • Last known good version: at least 3.4.0.1008975 was working OK
  • IDE: VS Windows 2019 P3
  • Platform Target Frameworks:

    • Android: 9.0

  • Android Support Library Version: 28.0.0.1

Reproduction Link

https://github.com/jonathanpeppers/glidex/tree/master/glidex.forms.sample

Android bug

All 6 comments

You shouldn't need to set $(AndroidLinkSkip) for Xamarin.Forms assemblies.

that would be true if

  • all the Xaml files are compiled
  • all the type converter, markup extensions, ... are compiled (not the case)

I saw this break when I updated from 3.4 to 4.0-pre4, so it seemed like a regression?

This project has XamlC: https://github.com/jonathanpeppers/glidex/blob/f8533cc09ce904cd79ffc8cc3a00b549bc130e0b/glidex.forms.sample/Properties/AssemblyInfo.cs#L17

I'm not saying this isn't a bug, and I'll look at it, but we're still far away from being able to link X.F.Core in all cases

馃憤 I went back on the history of this repo, and I had it this way since around Xamarin.Forms 2.5.

It might be that it was working for me so long because I've always had XamlC turned on.

EWORKSFORME

I can't repro this now....

I tried some combinations of things:

  • Using VS 2019 preview vs 2017 stable
  • Deploy in debug, then release
  • Deploy, upgrade Xamarin.Forms NuGet, deploy again

If this comes up again, I will save my bin/obj directories and look at the assembly.

Was this page helpful?
0 / 5 - 0 ratings