Open anpin opened 2 years ago
@anpin your repro project can‘t be unpacked. could you check for this and upload the correct one, thanks.
@kristinx0211 please try this maui-android-handler-activator-issue.zip
@anpin thanks for your update, I can repro this issue on android, ListView does not show, I'm not get the exception, on windows, the ListView is showing.
Here I'm running on another Android device. Can you share your Android screen shoot not Windows? What is your SDK version?
on android 12:
dotnet info:
on android 12:
dotnet info:
sorry I misread your original response, thought you said you can't reproduce it on Android
You can see original exception on Android if you configure logging as such
in csproj
use <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
and in MauiProgram.cs
use that builder.Services.AddLogging(l => l.AddConsole());
Adjusted repro here -> maui-android-handler-activator-issue.zip
I get the same exception when I want to migrate a Xamarin 5 project to MAUI. Unfortunately, this blocks me from migration to MAUI.
Used version: Visual Studio 2022 17.3.2
Starting on Android 12 results in the following exception:
System.MissingMethodException
Message=No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer'.
Update: This exception is catched by the library but it shows up in log. However, my crash at startup seems to be produced by another exception. For this one I get just the following info on Android (on Windows it works):
System.InvalidCastException: 'Specified cast is not valid.'
Verified this on Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Android 13.0 with below Project: 7799.zip
Exception:
[DOTNET] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'.
[DOTNET] at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[DOTNET] at System.Activator.CreateInstance(Type type)
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType, ServiceDescriptor single, IEnumerable`1 enumerable) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 141
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
[DOTNET] at Microsoft.Maui.Controls.Compatibility.Platform.Android.Platform.CreateRenderer(VisualElement element, Context context, FragmentManager fragmentManager, LayoutInflater layoutInflater) in D:\a\_work\1\s\src\Compatibility\Core\src\Android\AppCompat\Platform.cs:line 344
[Gralloc4] mapper 4.x is not supported
[DOTNET] [40m[1m[33mwarn[39m[22m[49m: Microsoft.Maui.Controls.Compatibility.Platform.Android.Platform[0]
[DOTNET] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'.
[DOTNET] at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[DOTNET] at System.Activator.CreateInstance(Type type)
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType, ServiceDescriptor single, IEnumerable`1 enumerable) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 141
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
[DOTNET] at Microsoft.Maui.Controls.Compatibility.Platform.Android.Platform.CreateRenderer(VisualElement element, Context context, FragmentManager fragmentManager, LayoutInflater layoutInflater) in D:\a\_work\1\s\src\Compatibility\Core\src\Android\AppCompat\Platform.cs:line 344
[DOTNET] [40m[1m[33mwarn[39m[22m[49m: Microsoft.Maui.Controls.Compatibility.Platform.Android.Platform[0]
[DOTNET] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer'.
[DOTNET] at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[DOTNET] at System.Activator.CreateInstance(Type type)
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType, ServiceDescriptor single, IEnumerable`1 enumerable) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 141
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
[DOTNET] at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
[DOTNET] at Microsoft.Maui.Controls.Compatibility.Platform.Android.Platform.CreateRenderer(VisualElement element, Context context, FragmentManager fragmentManager, LayoutInflater layoutInflater) in D:\a\_work\1\s\src\Compatibility\Core\src\Android\AppCompat\Platform.cs:line 344
We were suddenly seeing this exception on CollectionView while it was wrapped in a RelativeLayout from MAUI Compatibility. We ended up refactoring the particular page and removing the RelativeLayout.
Same problem here, we have a big Xamarin Forms application that we need to convert to .NET MAUI, without the compatibility layer we have to refactor ever page before release on .NET MAUI, which is probably to big task
We are facing same problem after upgrading from Net 7 to Net 8.0.3, and the hole app is based on Relative Layouts, to be honest we are loosing time, effort and money dealing with Maui, the last thing we want to see is a compat library that stops working with a simple update.... :( I´ll try to find a workaround) Forms to Maui is really a pain.
any update on the above exception that is getting for frame renderer as i was also facing same.
I had a similar issue with Frames
System.MissingMethodException: 'No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'.'
My workaround was to change the Frames to Borders
any updates? Noticing this on a client's project that I'm upgrading. also using compatibility mode and RelativeLayout with a ListView
I've resolved this by using a Grid implementation. Though, it might be good to reference this issue for people currently in the migration phase towards MAUI
Is there any news on this? I have a major project to convert from Xamarin.Forms, and am getting this on a very basic page that simply has a ListView as it's main content - if I can't get this page to work then I've no hope for the rest of the project!!!
Description
I've got following exceptions in a project I'm working on, so I tried to create repro with similar layout, but it doesn't throw the exception, however it doesn't show![Screenshot_20220606-214104](https://user-images.githubusercontent.com/6060545/172216836-a355571e-0300-4444-8929-262b6e971171.png)
ListView
items either at least on Android. In the right brownFrame
isListView
bound to the same collection asCollectionView
, with differentDataTemplate
.Steps to Reproduce
maui-android-handler-activator-issue.zip Unpack and build!
Version with bug
6.0 Release Candidate 3
Last version that worked well
Release Candidate 1
Affected platforms
Android
Affected platform versions
Android 9
Did you find any workaround?
no
Relevant log output