xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] No compatible code running on the thread in Android #15801

Closed ghost closed 10 months ago

ghost commented 10 months ago

Description :

When having breakpoint inside the ValueChanged event of slider, throws "No compatible code running on the thread" error in Android platform.

MainPage.xaml

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="SampleApp.MainPage">

    <StackLayout>
        <Slider Maximum="100"
                HeightRequest="50"
                ValueChanged="Slider_ValueChanged" />
    </StackLayout>

</ContentPage>

MainPage.xaml.cs

public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Slider_ValueChanged(object sender, ValueChangedEventArgs e)
        {

        }
    }

Steps to Reproduce :

  1. slide the slider, when putting breakpoint inside Slider_ValueChanged

Output image

Xamarin Forms - 5.0.0.2612 Android - API 33 Android OS 13

jfversluis commented 10 months ago

Looks like this should be fixed in Visual Studio 17.7 preview 4

https://github.com/dotnet/maui/issues/16189#issuecomment-1644037666