Can debug on simulator but CANT run app in debug on device and app quits in release with this error:

Cdn_EuroCdn_Euro Member ✭✭✭
edited December 2018 in Xamarin.Forms

Guys I do not know what happened but this error came up when running app in debug, I updated eveyrthing including windows and visual studio to all the latest updates as of 11 Dec 2018. What is going on??

UPDATE: App debugging in simulator works perfectly fine.
I just cannot debug, or run on device. It just quits with the error below:

2018-12-11 14:56:45.424 MyApp.iOS[1352:236793] Token received: <c888863b cb362ba8 3028fa09 ea6171ce e88231e3 f1d5f6a3 071e47aa 1b2511e3>
Thread started:  #9
Thread started: <Thread Pool> #10
Thread started: <Thread Pool> #11
Thread started: <Thread Pool> #12
Thread started: <Thread Pool> #13
Thread started: <Thread Pool> #14
2018-12-11 14:56:46.014 MyApp.iOS[1352:236793] <!DOCTYPE html>
        <title>The resource cannot be found.</title>
        <meta name="viewport" content="width=device-width" />
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

@media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.

            <b> Requested URL: </b>/push/installations/e99787d6-f94e-4ddf-888d-9b4e8e680bdd<br><br>

            <hr width=100% size=1 color=silver>

            <b>Version I
The app has been terminated.
llback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0()
   at System.Web.HttpApplication.StepInvoker.Invoke(Action executionStep)
   at System.Web.HttpApplication.StepInvoker.<>c__DisplayClass4_0.<Invoke>b__0()
   at Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule.OnExecuteRequestStep(HttpContextBase context, Action step)
   at System.Web.HttpApplication.<>c__DisplayClass284_0.<OnExecuteRequestStep>b__0(Action nextStepAction)
   at System.Web.HttpApplication.StepInvoker.Invoke(Action executionStep)
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &lt;customErrors mode="Off"/
nformation:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0


[HttpException]: The controller for path &#39;/push/installations/e99787d6-f94e-4ddf-888d-9b4e8e680bdd&#39; was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCa
&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.-->
Failed to Stop app:  An error occured on client IDB412377 while executing a reply for topic xvs/idb/
The app has been terminated.


  • LandLuLandLu Member, Xamarin Team Xamurai

    Without your sample we can't know what reason causes your issues.
    And can you depoy an empty blank app on your device?

  • Cdn_EuroCdn_Euro Member ✭✭✭
    edited December 2018

    @LandLu I would gladly share the page code but i haven't modified this page code and i am at the third version of this app and never had this error before, especially not on the respective page. I do not get this error in the simulator. If I do not get the error in the simulator it means its not from the code or is there something I am missing?

    Note: Also the app crashes with the error above NOT at the same point in the app. Sometimes I can navigate to the settings page as well before that happens. In th code below you can see the homepage or mainpage of the app. It contains a settings icon. Also its not in the MVVM format just yet, I will convert it once I fix this error.

  • Cdn_EuroCdn_Euro Member ✭✭✭
    using Acr.UserDialogs;
    using Plugin.SimpleAudioPlayer;
    using MyApp.Services;
    using MyApp.Utils;
    using MyApp.Views;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net.Http;
    using System.Net.Http.Headers;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    using Xamarin.Essentials;
    using Xamarin.Forms;
    using Xamarin.Forms.Xaml;
    namespace MyApp
        public partial class MyPage : ContentPage
            private static bool isSubscribed = false;
            private static string incomingMessage = null;
            private const string DISCLAIMER_TEXT = "Disclaimer and privacy url";
            private string appStoreVersion { get; set; }
            private bool hasUpdatedVersion { get; set; }
            public MyPage ()
                InitializeComponent ();
            public MyPage (string incomingNotificationBody)
                if (!string.IsNullOrEmpty(incomingNotificationBody))
                    incomingMessage = incomingNotificationBody;
            private string activeUserRegion { get; set; }
            protected async override void OnAppearing()
                bool hasSeenDisclaimer = Preferences.Get(AppConstants.DISCLAIMER_KEY, false);        
                string userRegion = Preferences.Get(AppConstants.REGION_KEY, AppConstants.ERROR_DEFAULT_MESSAGE);
                if (!hasSeenDisclaimer)
                    // show disclaimer
                    UserDialogs.Instance.Alert(DISCLAIMER_TEXT, "Disclaimer & Privacy Notice", "Ok");
                    Preferences.Set(AppConstants.DISCLAIMER_KEY, true);
                    // show activity indicator               
                    UserDialogs.Instance.ShowLoading("Checking for updates...");
                    // check for current version on the app store url
                    if (Device.RuntimePlatform == Device.iOS)
                        appStoreVersion = AppVersionServices.GetIosStoreAppVersion();
                        appStoreVersion = await AppVersionServices.GetAndroidStoreAppVersion();
                    // hide activity indicator                   
                    if (!string.IsNullOrEmpty(appStoreVersion))
                        hasUpdatedVersion = CompareVersions(appStoreVersion, AppInfo.VersionString);
                        if (!hasUpdatedVersion)
                            UserDialogs.Instance.Alert("Please visit the app store and download the newest version of MyApp to ensure best functionality.", "Update Available", "Ok");
                if(userRegion != AppConstants.ERROR_DEFAULT_MESSAGE)
                    activeUserRegion = userRegion;
                if (!isSubscribed)
                    MessagingCenter.Subscribe<object, string>(this, App.NotificationReceivedKey, OnMessageReceived);
                    isSubscribed = true;
                if ( !string.IsNullOrEmpty(incomingMessage) && incomingMessage.Contains(activeUserRegion) )
                    await Navigation.PushModalAsync(new AlarmDisplayPage(incomingMessage));
            private void OnMessageReceived(object sender, string incomingNotificationBody)
                if (!string.IsNullOrEmpty(incomingNotificationBody))
                    if (incomingNotificationBody.Contains(activeUserRegion)  || (incomingNotificationBody.Contains(AppConstants.TEST_MESSAGE)))
                        Device.BeginInvokeOnMainThread(async () =>
                            await Navigation.PushModalAsync(new AlarmDisplayPage(incomingNotificationBody));
            protected override bool OnBackButtonPressed()
                return true;
            protected override void OnDisappearing()
                if (isSubscribed)
                    MessagingCenter.Unsubscribe<object, string>(this, App.NotificationReceivedKey);
                    isSubscribed = false;
                incomingMessage = null;
            private bool CompareVersions (string storeVersionAsString, string currentVersionAsString)
                bool hasUpToDateVersion = true;
                double storeVersionAsDouble;
                double currentVersionAsDouble;
                bool isStoreVersionConversionSuccessful = Double.TryParse(storeVersionAsString, out storeVersionAsDouble);
                bool isCurrentVersionConversionSuccessful = Double.TryParse(currentVersionAsString, out currentVersionAsDouble);
                if (isStoreVersionConversionSuccessful && isCurrentVersionConversionSuccessful)
                    if (storeVersionAsDouble > currentVersionAsDouble)
                        hasUpToDateVersion = false;
                return hasUpToDateVersion;
            private void DoPageSetup()
                //set the icon image for settings option
                var assembly = typeof(MyAppPage);
                imageSettings.Source = ImageSource.FromResource("MyApp.Assets.Images.settings_icon.png", assembly);
                var settingsIconTapGestureRecognizer = new TapGestureRecognizer();
                settingsIconTapGestureRecognizer.Tapped += async (s, e) =>
                    //handle the tap
                    await Navigation.PushAsync(new SettingsPage());
  • JohnHardmanJohnHardman GBUniversity mod
    edited December 2018


    Two things jump out:

    (1) What would be requesting the URL "/push/installations/e99787d6-f94e-4ddf-888d-9b4e8e680bdd"? I assume that's the iOS app store version check? That appears to be what's failing.
    (2) There is a lack of exception handling throughout the code, which doesn't help when problems occur, particularly in production.

  • Cdn_EuroCdn_Euro Member ✭✭✭
    edited December 2018
    @JohnHardman the error handling (try catch blocks) for checking the version are performed within the methods that are called themselves.

    I actually commented out the entire version checking in the else statement and I still get the error. So I’m concluding it’s not from there.

    The point is since I’m commenting out the version checking and I still get the error i have no idea what the “push/installation”’ is referring to.
  • Cdn_EuroCdn_Euro Member ✭✭✭
    edited December 2018
    @LandLu @JohnHardman
    I just realized what the error is referring to. I am suspecting the push/installation/.... is referring to the push "Notifications" installation id. The app uses push notifications with Azure Hub. I have downloaded the app from the store so it registered with a production installation id. Now back into development mauybe its searching for the wrong installation id... Any idea if this is what could be happening and how I could reset the installation id (or force the app to get a new installation id for ios) in the Azure push notification hub? I think there could be trouble when using the device in devleopment and production alternatively in terms of push notifications and how it registers with the hub...
  • Cdn_EuroCdn_Euro Member ✭✭✭
    edited December 2018

    I stopped the app from crashing, this is where the error is coming from. Any idea how to fix this?

    private async Task SendRegistrationToServerAsync(NSData deviceToken)
                //this is the template/payload used by iOS. It contains the "messageParam"
                // that will be replaced by our service
                const string templateBodyAPNS = @"{
                                                    ""aps"" : {
                                                        ""alert"" : ""$(messageParam)"",
                                                        ""mutable-content"": 1
                var templates = new JObject();
                templates["genericMessage"] = new JObject
                    {"body", templateBodyAPNS }
                // send registration to web api for PRODUCTION
                // var client = new MobileServiceClient(MyApp.App.MobileServiceUrl);
                // send registration to web api for DEVELOPMENT
                var client = new MobileServiceClient(AppConstants.AZURE_DEVELOPMENT_WEB_API_URL);
                      // error comes from this line
                      await client.GetPush().RegisterAsync(deviceToken, templates);                
                catch (Exception ex)
                //get the installation id for Development
                Console.WriteLine("Installation id: " + client.InstallationId.ToString());
Sign In or Register to comment.