What is the exception that this code is throwing and how to fix it?

Vijayadithyan .N 121 Reputation points
2022-05-09T02:25:01.423+00:00

the code is:

include "pch.h"

using namespace winrt;

using namespace Windows;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::Foundation::Numerics;
using namespace Windows::UI;
using namespace Windows::UI::Core;
using namespace Windows::UI::Composition;

struct App : IFrameworkView
{
void Initialize(CoreApplicationView const& applicationView)
{

}  

void Load(hstring const&)  
{  
}  

void Uninitialize()  
{  
}  

void Run()  
{  
    CoreWindow window = CoreWindow::GetForCurrentThread();  
    window.Activate();  

    CoreDispatcher dispatcher = window.Dispatcher();  
    dispatcher.ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);  
}  

void SetWindow(CoreWindow const & window)  
{  

}  

};

struct AppSource : IFrameworkViewSource
{
virtual IFrameworkView CreateView()
{
return App();
}
};

int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
{
CoreApplication::Run(AppSource());
}

It shows the window for a few seconds and then stops, throwing this window:
200081-image.png

How can i fix this?

Universal Windows Platform (UWP)
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,518 questions
{count} votes