Skip to content

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

Closed
CommunityToolkit/Maui.Markup
#412

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

Activity

  1. tranb3r commented on Feb 12, 2026

    @tranb3r
    Author

    Also seeing this one:

    [System.MethodAccessException]: Method `Microsoft.Maui.JavaObjectExtensions.IsAlive(Java.Lang.Object)' is inaccessible from method `CommunityToolkit.Maui.Behaviors.TouchBehavior.UpdateClickHandler()'
    
  2. VladislavAntonyuk commented on Feb 12, 2026

    @VladislavAntonyuk
    Contributor

    We don't support preview versions. We'll get a compilation error if we use inaccessible method.

  3. airtaxi commented on Feb 13, 2026

    @airtaxi

    This happens even with official MAUI 10.0.40 and CommunityToolkit.MAUI 14.0.0

  4. airtaxi commented on Feb 13, 2026

    @airtaxi

    Workaround: Downgrading MAUI version to 10.0.31 works with CommunityToolkit.MAUI version 14.0.0 (13.0.0 with 10.0.40 still crashes the Android application)

  5. tranb3r commented on Feb 13, 2026

    @tranb3r
    Author

    Closing this issue just a few hours before the release was probably not the smartest thing to do...
    @VladislavAntonyuk Could you please reopen this issue?

  6. StephanArnas commented on Feb 13, 2026

    @StephanArnas

    Hello,
    I can confirm that we are experiencing the same issue on our side as well.
    I’m available to help if a reproduction example is needed.

    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(VisualElement bindable, View platformView) in /_/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs:line 44
       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(Object sender, EventArgs e) in /_/src/Controls/src/Core/Interactivity/PlatformBehavior.cs:line 107
       at Microsoft.Maui.Controls.VisualElement.SendLoaded(Boolean updateWiring) in /_/src/Controls/src/Core/VisualElement/VisualElement.cs:line 2362
       at Microsoft.Maui.Controls.VisualElement.SendLoaded() in /_/src/Controls/src/Core/VisualElement/VisualElement.cs:line 2355
       at Microsoft.Maui.Platform.ViewExtensions.<>c__DisplayClass44_0.<OnLoaded>b__2(Object _, ViewAttachedToWindowEventArgs __) in /_/src/Core/src/Platform/Android/ViewExtensions.cs:line 600
       at Android.Views.View.IOnAttachStateChangeListenerImplementor.OnViewAttachedToWindow(View attachedView)
       at Android.Views.View.IOnAttachStateChangeListenerInvoker.n_OnViewAttachedToWindow_Landroid_view_View_(IntPtr jnienv, IntPtr native__this, IntPtr native_attachedView)
    
  7. changed the title [-][BUG] TouchBehavior fails with MethodAccessException when using dotnet/maui main branch[/-] [+][BUG] TouchBehavior fails with MethodAccessException when using MAUI 9.0.40[/+] on Feb 13, 2026
  8. TheCodeTraveler commented on Feb 13, 2026

    @TheCodeTraveler
    Collaborator
  9. TheCodeTraveler commented on Feb 13, 2026

    @TheCodeTraveler
    Collaborator

    I've confirmed that this is a bug introduced by breaking changes in Microsoft.Maui.Controls v10.0.40

    Workaround

    To use CommunityToolkit.Maui v14.0.0, downgrade to Microsoft.Maui.Controls v10.0.31 until the .NET MAUI team can publish a fix

  10. TheCodeTraveler commented on Feb 13, 2026

    @TheCodeTraveler
    Collaborator

    Update

    I am working with the .NET MAUI engineers team to resolve this and have opened an Issue on the .NET MAUI repo: dotnet/maui#34048

    Root Cause

    This .NET MAUI PR revoked InteralsVisibleTo for the .NET MAUI Toolkits which is causing the Issue. InteralsVisibleTo allowed us to access non-public APIs that we can no longer access in Microsoft.Maui.Controls v10.0.40.

    Short Term Plan

    In the short-term, the .NET MAUI Engineering team plans to revert dotnet/maui#33442 and publish Microsoft.Maui.Controls v10.0.41.

    After Microsoft.Maui.Controls v10.0.41 is released, we will publish CommunityToolkit.Maui v14.0.1 which will take a dependency on Microsoft.Maui.Controls v10.0.41 to ensure no developers accidentally try to use Microsoft.Maui.Controls v10.0.40.

    Long Term Plan

    In the long-term, I've asked the .NET MAUI Engineering team to promote the APIs we use from internal to public. Once this is done, we will proceed with re-revoking InteralsVisibleTo for the .NET MAUI Toolkits and I will work directly with the .NET MAUI Engineering team to ensure no breaking changes to the .NET MAUI Toolkits.

  11. locked and limited conversation to collaborators on Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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