Xamarin forms: Getting exception when use displayactionsheet in UWP(Android part working fine)

0

I am getting the following exception when using displayactionsheet and app stop working in UWP, the android part is working fine.

The thread 0x5464 has exited with code 0 (0x0).
The thread 0xac4 has exited with code 0 (0x0).
The program '[12688] Business_App.UWP.exe' has exited with code -1 (0xffffffff).
Exception thrown: 'System.Exception' in Business_App.UWP.McgInterop.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.dll
Unhandled exception at 0x0715DC3C (Windows.UI.Xaml.dll) in Business_App.UWP.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x11665010, 0x00000004).

Following is my code:

string action = await DisplayActionSheet(null, "Cancel", null, "View History", "Add Customers");
if (action == "View History")
 {
    //Do some stuff
 }
 else if (action == "Add Customers")
 {
    //Do some stuff
 }

I added breakpoints and app break at the DisplayActionSheet line and redirecting to App.g.i.cs. Screenshot adding below. enter image description here

This is a new issue for me, anybody please suggest a solution.

Thanks in advance.

exception
xamarin.forms
asked on Stack Overflow Sep 17, 2018 by Sreejith Sree • edited Sep 18, 2018 by Sreejith Sree

1 Answer

0

Finally found the issue.

The issue was with the xaml file, I wrongly close the stacklayout.

    <StackLayout
                x:Name="selectedlocationLayout"
                IsVisible="False"
                  Orientation="Horizontal">

        // UI attributes    

        <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer
                    Tapped="SelectedLocationGesture"
                    NumberOfTapsRequired="1">
                    </TapGestureRecognizer>
                </StackLayout.GestureRecognizers>
            </StackLayout>

I add the close tag of StackLayout before the stacklayout GestureRecognizers.

Please see the 50th line of App.g.i.cs, Telling about xaml genarated break on unhandled exception. So I verify the xaml again and pick the issue.

answered on Stack Overflow Sep 18, 2018 by Sreejith Sree

User contributions licensed under CC BY-SA 3.0