I am using the UWP Xaml hosting API for my Win32 C++ App. I have the following code:
winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager XamlManager = winrt::Windows::UI::Xaml::Hosting::
WindowsXamlManager::InitializeForCurrentThread();
winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource XamlSource;
When I am finished with the UWP Content, I am calling
XamlSource.Close();
XamlManager.Close();
But the output window from the debugger indicates an exception is being thrown:
windows\advcore\winrt\iwindow\corewindow\desktop\desktopwindowcontentbridge.cpp(499)\Windows.UI.dll!00007FFD91CD860F: (caller: 00007FFD91CD7704) ReturnHr(1) tid(7168) 8007139F The group or resource is not in the correct state to perform the requested operation.
What am I doing wrong?