System.Runtime.InteropServices.COMException caused while terminating the app

I have an app with 2 pages calendar.xaml(start page) and historystatistics.xaml. Error is thrown when I navigate to historystatistics and back to calendar and then try to terminate the app by the pulling down gesture. The mentioned error occurs at the SaveAsync function in OnSuspending of App.xaml.

private async void OnSuspending(object sender, SuspendingEventArgs e) { CycleManager cycMan = CycleManager.Instance; var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Save application state and stop any background activity if (cycMan.Reset != true) { await Appname.Common.SuspensionManager.SaveAsync(); // **ERROR** } deferral.Complete(); }

It says

An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code.

GetNavigationState doesn't support serialization of a parameter type which was passed to Frame.Navigate.

Where did I wrong? I did a simple navigation from historystatistics page from xaml like this

<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>


The problem is that SuspensionManager uses Frame.GetNavigationState() to get the history of the Frame. It then tries to serialize the navigation history to a string, unfortunately it has no way to know how to serialize custom complex types .

From MSDN :

Note The serialization format used by these methods is for internal use only. Your app should not form any dependencies on it. Additionally, this format supports serialization only for basic types like string, char, numeric and GUID types.

The best solution for this problem to rewrite the NavigationParameter or if you didn't want to save your app state just comment the line :

private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //await SuspensionManager.SaveAsync(); deferral.Complete(); }


  • Recursive process.nextTick warning
  • SQLite.Net Won't Create In Win IoT Library
  • How to extract a number from a string [duplicate]
  • EditText is covered by Keyboard
  • Javascript focus remove text highlight
  • C#: Import/Export Settings into/from a File
  • How can I tell a form not to dispose a particular control when it closes?
  • How Get arguments value using inline assembly in C without Glibc?
  • Multiple producers single consumer locking schema
  • How to make R's read_csv2() recognise the text characters properly
  • Tell Git to stop prompting me for conflicts when none really exist?
  • SonarQube: Cannot deactivate rule with missing quality profile
  • URLConnection doesn't work since API 10 and higher?
  • Implementation of State Monad
  • gspread or such: help me get cell coordinates (not value)
  • How can I set a binding to a Combox in a UserControl?
  • AJAX Html Editor Extender upload image appearing blank
  • SplFileObject error failed to open stream: No such file or directory
  • print() is showing quotation marks in results
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Play WS (2.2.1): post/put large request
  • Refering to the class itself from within a class mehod in Objective C
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Google Custom Search with transparent background
  • Android fill_parent issue
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • Repeat a vertical line on every page in Report Builder / SSRS
  • C# - Serializing and deserializing static member
  • Sending data from AppleScript to FileMaker records
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Trying to switch camera back to front but getting exception
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Calling of Constructors in a Java
  • PHP: When would you need the self:: keyword?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to include full .NET prerequisite for Wix Burn installer
  • Is it possible to post an object from jquery to bottle.py?
  • unknown Exception android
  • EntityFramework adding new object to nested object collection