private void OnSuspending(object sender, SuspendingEventArgs e)
{
...
var deferral = e.SuspendingOperation.GetDeferral();
string sState = (Window.Current.Content as Frame).GetNavigationState();
...
}
The above code works fine most of the time, but throws the following exception occasionally:
System.Exception: Unspecified error
GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate.
Stack Trace:
at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Void*) + 0xbe
at __Interop.ForwardComStubs.Stub_2[TThis](__ComObject, Int32) + 0x36
at Windows.UI.Xaml.Controls.Frame.GetNavigationState() + 0x18
I am wondering if anyone could shed some light on the possible causes of this. I am unable to reproduce this, but an app's analytics reports quite a few of this exception.