microsoft / HoloLensForCV

Sample code and documentation for using the Microsoft HoloLens for Computer Vision research
MIT License
475 stars 154 forks source link

cant catch the Exception in the Concurrency Runtime #163

Closed 2329677402 closed 1 year ago

2329677402 commented 1 year ago

in cpp file Shared\HoloLensForCV\SensorFrameStreamingServer.cpp

void SensorFrameStreamingServer::SendImage( SensorFrameStreamHeader^ header, const Platform::Array^ data) .............. Concurrency::create_task(_writer->StoreAsync()).then( [&](Concurrency::task writeTask) { try { // Try getting an exception. writeTask.get(); // throw ref new Platform::Exception(E_FAIL); _writeInProgress = false; } catch (Platform::Exception^ exception) { dbg::trace(L"SensorFrameStreamingServer::SensorFrameStreamingServer: StoreAsync %s", exception->Message->Data()); _socket = nullptr; } // return writeTask; }) ...........

after client connect to hololens, while send the image, just close the client app,. the socket server in hololens should catch and handle the exception: WinRT : An existing connection was forcibly closed by the remote host.

but actually, it does not. so the server was crashed.

I also raised a ticket for MS's visual studio support engineer, no response till now, below is the link https://learn.microsoft.com/en-us/answers/questions/1340260/cant-catch-the-exception-in-the-concurrency-runtim

anyone meet the same issue can ping me, thank you very much