Declined
Last Updated: 03 Nov 2021 18:10 by ADMIN
Simba
Created on: 03 Nov 2021 13:08
Category: UI for Xamarin
Type: Bug Report
1
Errors with latest versions of AndroidX

Please refer to this issue: https://feedback.telerik.com/xamarin/1509502-errors-with-latest-versions-of-androidx

Hello this problem seems to be still prevalent in "Release" mode when using the individual libraries as well, in my case I am referencing the lite libraries from telerik nuget (Telerik.UI.for.Xamarin.Input.Lite + Telerik.UI.for.Xamarin.DataControls.Lite 2021.3.915.1).

There are no error when the workaround for this is to set Linking to "None". Project is latest XF 5.0.0.2196 with all latest AndroidX libraries: Project targets Android 10 (Q) 

----------------------------------------------------------------------------------
Severity Code Description Project File Line Suppression State
Error Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Telerik.XamarinForms.Common.GeometryTypeConverter' (defined in assembly 'Telerik.XamarinForms.Primitives, Version=2021.3.915.500, Culture=neutral, PublicKeyToken=null') with scope 'Telerik.XamarinForms.Common, Version=2021.3.915.500, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Telerik.XamarinForms.Common.GeometryTypeConverter
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArgument(CustomAttributeArgument argument)
   at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
   at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca)
   at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider)
   at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
1 comment
ADMIN
Lance | Senior Manager Technical Support
Posted on: 03 Nov 2021 18:10

Hi Luc,

Thank you for sharing the stack trace, it was very helpful in explaining why you're getting an exception. That problem is unrelated to AndroidX, let me explain why.

The AndroidX exception you pointed to in the other thread, was because of a misspelling that Microsoft fixed. They fixed a misspelling of the word "Accessibility" in a namespace that caused breaking changes. So, any downstream consumers of that specific Android support library, needed to update their code to use the new namespace.

Current Problem

Okay, now on to what might be wrong with your situation.

The bottom line is that we do not fully support complete linking. This is because the linker is too aggressive and removes code that it doesn't have a direct 'link' to. so basically, if you don't directly use a specific piece of code in your app (the 'user assembly'), then it is going to get stripped out.

Solution

To solve this, we offer a couple suggestions. Please carefully read this article on the topic How to Avoid Exception From Setting Linker Behavior to Link All | Telerik UI for Xamarin

Now that you've read it, let's talk about the options.

Option 1

I would recommend Option #1 and set the Linker Behavior to

  • "None" for Android
  • "SDK only" on iOS

Option 2

However, if you want to try Option #2, then you will need to add all the assembly names that are getting stripped out (and causing the exceptions) to the AndroidLinkSkip list.

For example, in the stack trace you shared states the following:

Could not resolve reference to 'Telerik.XamarinForms.Common.GeometryTypeConverter' (defined in assembly 'Telerik.XamarinForms.Primitives)...

So you want to make sure the linker isn't stripping out code from the Telerik.XamarinForms.Primitives assembly

<PropertyGroup>
    <AndroidLinkSkip>Telerik.XamarinForms.Primitives</AndroidLinkSkip>
</PropertyGroup>

Continue Triage

If you continue to get exceptions, then you'll want to keep adding assemblies to that list. For example, you can add multiple assemblies like this:

<PropertyGroup>
    <AndroidLinkSkip>Telerik.XamarinForms.Common;Telerik.XamarinForms.Primitives</AndroidLinkSkip>
</PropertyGroup>

Wrapping Up

Ultimately, this is a problem with how linking works and not code within the Telerik UI for Xamarin NuGet packages or assemblies, therefore I am marking this Bug Report as Declined. If you continue to have problems please open a Technical Support Ticket, instead of a Bug Report, so that we can better assist.

Tip - If you do open a case, please be sure to include your projects csproj files and any related code.

Regards,
Lance | Manager Technical Support
Progress Telerik

Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.