Xamarin.forms: [Bug] Tizen crashes on Forms.Init

Created on 8 Jan 2020  路  5Comments  路  Source: xamarin/Xamarin.Forms

Description

System.TypeLoadException: Could not load type 'Xamarin.Forms.Platform.Tizen.ExportRendererAttribute' from assembly 'Xamarin.Forms.Platform.Tizen, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
   at Xamarin.Forms.Internals.ReflectionExtensions.GetCustomAttributesSafe(Assembly assembly, Type attrType)
   at Xamarin.Forms.Internals.Registrar.RegisterAll(Type[] attrTypes, InitializationFlags flags)
   at Xamarin.Forms.Internals.Registrar.RegisterAll(Type[] attrTypes)
   at Xamarin.Forms.Forms.SetupInit(CoreApplication application, InitializationOptions options)
   at Xamarin.Forms.Forms.Init(CoreApplication application, Boolean useDeviceIndependentPixel)
   at Tizen.Program.Main(String[] args)

Steps to Reproduce

  1. Create default app
  2. add SkiaSharp.Views.Forms and SkiaSharp to SharedApp
  3. add SkiaSharp.Views.Forms, SkiaSharp.Views and SkiaSharp to Tizen app
  4. run app

Expected Behavior

App not crashes

Actual Behavior

App crashes

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:

    • iOS:

    • Android:

    • UWP:

  • Android Support Library Version:
  • Nuget Packages: Latest nightly build
  • Affected Devices:

Screenshots


image

Tizen unverified bug

Most helpful comment

@rookiejava I got a PR building now https://github.com/mono/SkiaSharp/pull/1109

All 5 comments

Same as #9134.

I was struggling with the same issue. SkiaSharp.Views.Forms has to be updated due to #7193.

Hi there! Thank you for reporting the issue and sorry for the inconvenience.

As @panpawel88 mentioned, there was an ABI break in the Tizen backend at #7193. As you can see from the PR, it'a about fixing some misused namespaces correctly to be consistent with other platforms. And, this fix is reflected in the Xamarin.Forms 4.2.0.709249. So if you are using Xamarin.Forms version 4.2 or above, you should use Forms.Init and ExportRenderer to match the changed namespace.

The problem occurs when you use skiaSharp together. The root cause is that the latest version of SkiaSharp (1.68.2-preview.17) is still dependent on Xamarin.Forms 4.0.0.540366. Therefore, to resolve this issue fundamentally, we need to update the version of Xamarin.Forms referenced by SkiaSharp to 4.2.0 or higher. To do this, we will also PR to the SkiaSharp project.

Again, sorry for the inconvenience anyway.
As a temporary way, I recommend using the version of Xamarin.Forms 4.0.0.540366 (referenced by SkiaSharp) in your app until the above modification is complete.

@rookiejava I got a PR building now https://github.com/mono/SkiaSharp/pull/1109

Whoops! Forgot to let everyone know that this has been pushed to nuget: https://www.nuget.org/packages/SkiaSharp.Views.Forms/1.68.2-preview.21

Was this page helpful?
0 / 5 - 0 ratings