Skip to content

[BUG] TouchBehavior fails with MethodAccessException when using MAUI 9.0.40 #3089

@tranb3r

Description

@tranb3r

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

TouchBehavior throws a System.MethodAccessException at runtime when running against the latest dotnet/maui (9.0.40).

Probably because TouchBehavior.android.cs calls the internal method Microsoft.Maui.Platform.ViewExtensions.GetParentOfType<T>(), but dotnet/maui removed the InternalsVisibleTo attribute for CommunityToolkit assemblies in PR dotnet/maui#33442.

Expected Behavior

No runtime exception.

Stack trace

[System.MethodAccessException]: Method `Microsoft.Maui.Platform.ViewExtensions.GetParentOfType[Android.Views.ViewGroup](Android.Views.View)' is inaccessible from method `CommunityToolkit.Maui.Behaviors.TouchBehavior.OnAttachedTo(Microsoft.Maui.Controls.VisualElement,Android.Views.View)'
 	at CommunityToolkit.Maui.Behaviors.TouchBehavior.OnAttachedTo + 0x16(Unknown Source)
 	at Microsoft.Maui.Controls.PlatformBehavior`2[[Microsoft.Maui.Controls.VisualElement, Microsoft.Maui.Controls, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].OnLoaded + 0x37(Unknown Source)

Environment

- .NET MAUI CommunityToolkit: 14.0.0
- OS: android
- .NET MAUI: 10.0.40-ci.main.26111.16

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions