Crash calling DisplayAlert when using Windows Assigned Access

poulterrpoulterr USUniversity ✭✭

We've just upgraded our Xamarin UWP app, which we sideload and run on kiosks (Surface 3s, Windows 10) in Assigned Access mode, to Forms 2.3.4.231 from Forms 2.3.3.180. As soon as DisplayAlert is called the app crashes with:

"A COM call to an ASTA was blocked because the call chain originated in or passed through another ASTA. This call pattern is deadlock-prone and     disallowed by apartment call control."

We see this exception reported in HockeyApp. This does not occur when we run the app logged in as the assigned access user, only when the app is set to start automatically.

Any news on whether this has been seen in testing and when it will be fixed.

Posts

  • MaximKhlupnovMaximKhlupnov RUMember

    Has the same issue. Looks like Xamarin's runtime use wrong dispatcher. For UWP kiosk app
    CoreApplication.MainView.Dispatcher would cause the app crash because in assigned access mode, the main window is not MainView but rendered in a secondary view. It is recommended you use CoreApplication.GetCurrentView.Dispatcher.

    https://docs.microsoft.com/en-us/windows-hardware/drivers/partnerapps/create-a-kiosk-app-for-assigned-access

    Exception path in my case is following Windows.ApplicationModel.Core.CoreApplicationView.get_CoreWindow()
    Xamarin.Forms.Platform.UWP.WindowsBasePlatformServices.get_IsInvokeRequired()

  • David.MyersDavid.Myers USMember

    As Maxim pointed out, this appears to be caused by the implementation of WindowsBasePlatformServices.IsInvokeRequired.

    Currently, it directly requests "CoreApplication.MainView.CoreWindow.Dispatcher", which is not valid from an assigned access app.

    A solution might be to use the CoreDispatcher that is passed to the class through the constructor. The dispatcher passed to the constructor is "Window.Current.Dispatcher", which sounds like it should be safe to use.

  • David.MyersDavid.Myers USMember
    edited August 2017

    Yep, I changed WindowsBasePlatformServices.cs:117 to:

    public bool IsInvokeRequired => !_dispatcher.HasThreadAccess; // !CoreApplication.MainView.CoreWindow.Dispatcher.HasThreadAccess;

    And now the app works in assigned access mode.

    I don't have time at the moment to submit this to Bugzilla, so feel free to do so. If I have time later in the week I'll submit it formally.

  • poulterrpoulterr USUniversity ✭✭

    Thanks for the investigation and comments. Fortunately for us, we've upgraded to Forms 2.3.4.247 and all seems to be good again.

  • poulterrpoulterr USUniversity ✭✭

    Unfortunately the issue returned after Windows 10 Cumulative Update for 2017-09 installed and it continued after the CU for 2017-10. We have updated to Forms 2.4.0.282 and then 2.4.0.18342 with no improvement and are about to test an update to Forms 2.4.0.38779.

  • poulterrpoulterr USUniversity ✭✭

    This continues to persist after upgrading to Windows 10 1709, applying the CU for 2017-11 and upgrading to Forms 2.4.0.38779. The stacktrace in HockeyApp shows:

    SharedLibrary!+0x3a13cd
    Mobile.Kiosk.UWP!+0x138410f
    Mobile.Kiosk.UWP!+0x1384386
    Plugin.Threading.UIThreadRunInvoker.BeginInvokeOnUIThread(Action action)
    Xamarin.Auth.Authenticator.OnSucceeded(Auth.Account account)
    Xamarin.Auth.Authenticator.OnSucceeded(String username, Collections.Generic.IDictionary<System.String,System.String> accountProperties) Xamarin.Auth.OAuth2Authenticator.OnRetrievedAccountProperties(Collections.Generic.IDictionary<System.String,System.String> accountProperties)
    Xamarin.Auth.OAuth2Authenticator.OnRedirectPageLoaded(Uri url, Collections.Generic.IDictionary<System.String,System.String> query, Collections.Generic.IDictionary<System.String,System.String> fragment)
    Xamarin.Auth.WebRedirectAuthenticator.OnPageEncountered(Uri url, Collections.Generic.IDictionary<System.String,System.String> query, Collections.Generic.IDictionary<System.String,System.String> fragment)
    Xamarin.Auth.OAuth2Authenticator.OnPageEncountered(Uri url, Collections.Generic.IDictionary<System.String,System.String> query, Collections.Generic.IDictionary<System.String,System.String> fragment)
    Xamarin.Auth.WebRedirectAuthenticator.OnPageLoading(Uri url)
    Mobile.Kiosk.UWP!+0x1e529f3
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    SharedLibrary!+0x502069
    SharedLibrary!+0x3a9bde
    SharedLibrary!+0x3e681c
    SharedLibrary!+0x3a13cd
    Mobile.Kiosk.UWP!+0x138730c
    Mobile.Kiosk.UWP!+0x138726f
    Microsoft.HockeyApp.Extensibility.Windows.UnhandledExceptionTelemetryModule.CoreApplication_UnhandledErrorDetected(Object sender, ApplicationModel.Core.UnhandledErrorDetectedEventArgs e)

    We are using Xamarin Auth and I'm now wondering if the issue relates to that.

  • NMackayNMackay GBInsider, University mod

    @poulterr

    You have to post a bugzilla (sorry if you already have) and chase on the main release threads, your issue will be missed here. it will be totally missed here. It won't be picked up as an issue.

  • poulterrpoulterr USUniversity ✭✭

    Have a look at bugzilla.xamarin.com bug id is 60204.

Sign In or Register to comment.