Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Android 10 - Application closes when using the ToPngAsync routine #80

Closed
JulianoBazzi opened this issue Nov 4, 2020 · 2 comments

Comments

@JulianoBazzi
Copy link

JulianoBazzi commented Nov 4, 2020

Description

I have a Xamarin Forms project that is using version 2.2.6 of Forms9Patch and being compiled for Android 9. However, as in November on Google Play, only applications compiled with Android 10 will be accepted. I am changing this project of mine to be compiled with Android 10.

Compiling on Android 10 and forms9Patch version 2.2.6 when using the ToPngService.ToPngAsync routine the application freezes, it is just that function.

I found another topic here on GitHub related to a bug in Android 10 and then I decided to update my project's Forms9Patch to version 2.4.6. However after I updated it, the ToPngService.ToPngAsync routine simply gives the message "System.InvalidCastException: Specified cast is not valid." and close the application.

I was able to reproduce this situation in the sample source attached to this task.

Steps to Reproduce

  1. HTML to PDF service
  2. Android 10

Basic Information

  • Version with issue: 2.4.6
  • Last known good version: 2.2.6
  • IDE: Visual Studio Community 2019 - 16.7.7
  • Android: Android 10
  • Affected Devices: Samsung SM-P205 (Android 10)

Reproduction Link - a link to a small demo project that reproduces this issue

MyMvvmCrossApp1.zip

@JulianoBazzi
Copy link
Author

JulianoBazzi commented Nov 4, 2020

In version 2.4.2 of Forms9Patch there were no problems with crashing the app.

@baskren
Copy link
Owner

baskren commented Nov 19, 2020

First, thank you for taking the time to create a demo project. As a result, you were bumped ahead of another issue that did not make the effort.

Second, please accept my apologies for not responding sooner. This is a volunteer effort and, in general, things that pay the bills take priority.

Here is what I've learned

  1. You have not initiated Forms9Patch in your platform project. In MyMvvmCrossApp1.Droid/Views/MainActivity.cs, you need to add the following immediately after Platform.Init(this, bundle);
 Forms9Patch.Droid.Settings.Initialize(this);
  1. You didn't install Forms9Patch nuget package in your Android platform projects.

After the above two steps, everything appears to be working. I have no idea how, with earlier versions of Forms9Patch, you were able to have a working project without the above elements.

@baskren baskren closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants