Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [Android] Using ViewCell with TapGestureRecognizer and DisplayPromptAsync causes Java.Lang.IllegalStateException #4201

Closed
mterhorst opened this issue Jan 19, 2022 · 3 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@mterhorst
Copy link

mterhorst commented Jan 19, 2022

Description

Somehow I can trigger Java.Lang.IllegalStateException with DisplayPromptAsync inside TapGestureRecognizer event.
This does not happen if I change it to a DisplayActionSheet.

image

Steps to Reproduce

New sample MAUI project.

namespace MauiApp1;

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

    private async void Tap1(object sender, EventArgs e)
    {
        var result = await DisplayActionSheet("Hello", "Cancel", null, "Yes", "No");
    }

    private async void Tap2(object sender, EventArgs e)
    {
        var result = await DisplayPromptAsync("", "Hello", "Ok", "Cancel", initialValue: "", keyboard: Keyboard.Default);
    }
}
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage"
             BackgroundColor="{DynamicResource SecondaryColor}">

	<ContentPage.Content>
		<ScrollView>
			<TableView Intent="Settings">
				<TableRoot>
					<TableSection >
						<TextCell Text="Testing" Detail="" StyleId="disclosure"/>
						<ViewCell>
							<Grid Margin="4,2,0,2">
								<Label Text="Works" Grid.Column="1" FontSize="16" TextColor="Black" />
								<Grid.GestureRecognizers>
									<TapGestureRecognizer NumberOfTapsRequired="1" Tapped="Tap1" />
								</Grid.GestureRecognizers>
							</Grid>
						</ViewCell>
						<ViewCell>
							<Grid Margin="4,2,0,2">
								<Label Text="Does not work" Grid.Column="1" FontSize="16" TextColor="Black" />
								<Grid.GestureRecognizers>
									<TapGestureRecognizer NumberOfTapsRequired="1" Tapped="Tap2" />
								</Grid.GestureRecognizers>
							</Grid>
						</ViewCell>
					</TableSection>
				</TableRoot>
			</TableView>
		</ScrollView>
	</ContentPage.Content>

</ContentPage>

Run with debugger attached and see the problem.

Version with bug

Preview 12

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 9

Did you find any workaround?

No response

Relevant log output

No response

@mterhorst mterhorst added the t/bug Something isn't working label Jan 19, 2022
@PureWeen
Copy link
Member

There's a good chance this is fixed with
#4104

@mterhorst
Copy link
Author

Problem persists in prev. 12.

@hartez hartez added the fatal label Jan 20, 2022
@Eilon Eilon added the area-xaml XAML, CSS, Triggers, Behaviors label Feb 4, 2022
@wenwen60
Copy link

wenwen60 commented Feb 24, 2022

Not reproducible on Android 11 in VS2022 17.2.0 Preview 2.0 [32215.517.main].

@wenwen60 wenwen60 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Feb 24, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants