maui: System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer'

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 ListView items either at least on Android. In the right brown Frame is ListView bound to the same collection as CollectionView, with different DataTemplate. Screenshot_20220606-214104

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

[0:] [20:18:45 WRN] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer'.
   at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
   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
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
   at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
   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
[0:] [20:18:45 WRN] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'.
   at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
   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
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
   at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
   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
[0:] [20:18:45 WRN] System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer'.
   at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.Maui.Hosting.Internal.MauiFactory.CreateInstance(ServiceDescriptor item) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 162
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(ServiceDescriptor descriptor) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 130
   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
   at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiFactory.cs:line 36
   at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.GetHandler(Type type) in D:\a\_work\1\s\src\Core\src\Hosting\Internal\MauiHandlersFactory.cs:line 30
   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

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (1 by maintainers)

Most upvoted comments

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.

@EeKay this error happens even if you remove Compatibility NuGet package. It happens naturally when you add ListView

@rubiomiguel06 I did not found anything to help. If I remove <ListView, it does help 😃

P.S: Editing comment. I have though this was an reply for another topic.

2025-02-20 19:27, je Miguel Rubio napisal

So… no one from Microsoft team is even taking a look into this. I have just found myself with this same issue. Any workarounds?

– Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you commented.Message ID: @.***> rubiomiguel06 left a comment (dotnet/maui#7799) [1]

So… no one from Microsoft team is even taking a look into this. I have just found myself with this same issue. Any workarounds?

– Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you commented.Message ID: @.***>

Links:

[1] https://github.com/dotnet/maui/issues/7799#issuecomment-2672338310 [2] https://github.com/notifications/unsubscribe-auth/BNZZGHTGLZXK7GGQX2GZLGD2QYNAPAVCNFSM5YAD5UL2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENRXGIZTGOBTGEYA

This still happens on .NET9 + latest MAUI 9.0.30. Reading Telerik I thought it would help adding <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />, but it does not help.

Error: System.MissingMethodException: No parameterless constructor defined for type ‘Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer’.

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.