I have a class that is assigning itself to an event:
public MainMenuButton()
{
this.DefaultStyleKey = typeof(MainMenuButton);
(App.Current as App).ApplicationLanguageChange += Localize;
}
And on destructor i do this:
~MainMenuButton()
{
(App.Current as App).ApplicationLanguageChange -= Localize;
}
When on emulator i do a longpress on back button and close the app - the destructor throws an error:
An unhandled exception of type 'System.Exception' occurred in myapplication.WindowsPhone.exe
Additional information: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))