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 from Forms 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.


  • 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.

    Exception path in my case is following Windows.ApplicationModel.Core.CoreApplicationView.get_CoreWindow()

  • 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 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 and then with no improvement and are about to test an update to Forms

  • poulterrpoulterr USUniversity ✭✭

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

    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)
    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


    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 bug id is 60204.

Sign In or Register to comment.