none
Kinect sensor does not shutdown when code terminated from the visualstudio 2010 debugger RRS feed

  • Question

  • Hi all,

       I have been trying to find relevant information but have failed to find any information in this regard. In my demos, I use the latest Kinect for windows sdk (v1.5). If i close my application by terminating the application (close button in title bar or the esc key), I can run my kinect shutdown code. If on the other hand I use the debugger, the shutdown code is not executed thus Kinect is kept busy. This does not allow other applications to run Kinect. What is the solution for this?  Is there a close callback which can be called when the debugger is unhooked from the application?

    Thanks,

    MMMovania

    Tuesday, August 7, 2012 9:21 AM

All replies

  • Wrap your main line code in a try/finally block and place your shutdown code in the finally block. Then allow the application to end rather than simply exiting the debugger; that is, when you are done, disable all breakpoints and tell the debugger to "go". The Kinect must be gracefully stopped and related resources released before the application ends.

    If your application is crashing in one of the frame-ready event handlers, the crash may leave the Kinect in an indeterminant state requiring that it be physically disconnected and reconnected before another application can use it.

    Also note that using a debugger on an application is outside normal application usage since the flow of control can be interrupted and diverted without intermediate code being aware of it. There may be other scenarios where a Kinect sensor can be left in a bad state that cannot be programmatically recovered. 


    Gary Lewis | Sr. Support Escalation Engineer | Microsoft Windows User Interface Developer Support

    • Proposed as answer by Gary_Lewis Tuesday, August 7, 2012 3:16 PM
    Tuesday, August 7, 2012 3:16 PM
  • Hi,

      I am using C++ there is no finally block in it. I have wrapped my main loop in a try catch like this and called my kinect shutdown code in the catch block but still the code does not terminate the kinect

    try { doMainLoop();}

    catch(std::exception e) {std::err<<"Exception: "<<e.what()<<std::endl; kinectShutdown();}

    catch(...) {std::err<<"Unknown Exception: "<<std::endl; kinectShutdown();}


     

    Wednesday, August 8, 2012 1:55 AM
  • Please include the code in kinectShutdown specifically related to shutting down the Kinect sensor.

    Gary Lewis | Sr. Support Escalation Engineer | Microsoft Windows User Interface Developer Support

    Wednesday, August 8, 2012 3:15 PM