Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Found the issue. Well, the tip of the iceberg.</p> <p>The code of the InternalOnNavigatedFrom method is:</p> <pre><code>internal override void InternalOnNavigatedFrom(NavigationEventArgs e) { PhoneApplicationPage content = e.Content as PhoneApplicationPage; string str = ((content == null) || (content.Title == null)) ? string.Empty : content.Title; PerfUtil.BeginLogMarker(MarkerEvents.TH_ONNAVIGATEDFROM_PAGE, string.Format("{0},{1},{2}", (base.Title == null) ? "" : base.Title, e.NavigationMode, str)); this.OnNavigatedFrom(e); PerfUtil.EndLogMarker(MarkerEvents.TH_ONNAVIGATEDFROM_PAGE, string.Format("{0},{1},{2}", (base.Title == null) ? "" : base.Title, e.NavigationMode, str)); DeviceStatus.KeyboardDeployedChanged -= new EventHandler(this.OnKeyboardDeployedChanged); Task rootTask = ApplicationHost.Current.RootTask; rootTask.OnVisibleRegionChange = (ITask.VisibleRegionChanged) Delegate.Remove(rootTask.OnVisibleRegionChange, new ITask.VisibleRegionChanged(this.OnVisibleRegionChange)); Task task2 = ApplicationHost.Current.RootTask; task2.OnSipVisibilityChange = (ITask.SipVisibilityChange) Delegate.Remove(task2.OnSipVisibilityChange, new ITask.SipVisibilityChange(this.OnSipVisibilityChange)); this._lastSipHeight = 0.0; this._dictionary = null; } </code></pre> <p>After a bit of debugging, I concluded that neither <code>e</code> or <code>Application.Current.RootTask</code> were null. After scratching my head, I looked at the code of the <code>KeyboardDeployedChanged</code> event handler:</p> <pre><code>public static event EventHandler KeyboardDeployedChanged { [SecuritySafeCritical] add { if (KeyboardDeployedSubscription == null) { KeyboardDeployedSubscription = new SubscriptionHandler(DeviceTypes.KeyBoard); } KeyboardDeployedSubscription.Changed += value; } [SecuritySafeCritical] remove { KeyboardDeployedSubscription.Changed -= value; } } </code></pre> <p>This code is poorly written. If the <code>remove</code> part of the handler is called before the <code>add</code>, <code>KeyboardDeployedSubscription</code> will be null and an exception will be raised. To test my theory, I subscribed to the event in <code>App</code>'s constructor:</p> <pre><code> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; DeviceStatus.KeyboardDeployedChanged += (sender, e) =&gt; { }; </code></pre> <p>And sure enough, the exception was gone. Now, to understand why your code is triggering this issue, I backtraced to which part of the framework is supposed to subscribe to the event. The only candidate is the <code>InternalOnNavigatedTo</code> method.</p> <p>Therefore, your issue is that <code>OnNavigatedFrom</code> is called even though <code>OnNavigatedTo</code> was never called.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload