I have a simplest WinRt c++/cx template project in Visual Studio in which i modified only three lines in MainPage constructor and added simple event handler like this:
MainPage::MainPage()
{
InitializeComponent();
auto listener = ref new Windows::Networking::Sockets::StreamSocketListener;
listener->ConnectionReceived += ref new Windows::Foundation::TypedEventHandler<Windows::Networking::Sockets::StreamSocketListener ^, Windows::Networking::Sockets::StreamSocketListenerConnectionReceivedEventArgs ^>(this, &App3::MainPage::OnConnectionReceived);
Concurrency::create_task(listener->BindEndpointAsync(ref new Windows::Networking::HostName("127.0.0.1"), "6667")).get();
}
void MainPage::OnConnectionReceived(Windows::Networking::Sockets::StreamSocketListener ^sender, Windows::Networking::Sockets::StreamSocketListenerConnectionReceivedEventArgs ^args)
{
throw ref new Platform::NotImplementedException();
}
After running this project i'm getting debugger error like this:
Unhandled exception at 0x0F983C68 (msvcr120d_app.dll) in XXX.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
This project has enabled "Internet (Client and Server)" and "Private Networks" capabilities. So my question is: why i'm getting this error? It's a WinRt bug?