Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:20:51+00:00 2026-06-14T17:20:51+00:00

I am writing a kinect app in C# and I have this code try

  • 0

I am writing a kinect app in C# and I have this code

try             //start of kinect code
{
    _nui = new Runtime();
    _nui.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseColor);

    // hook up our events for video
    _nui.DepthFrameReady += _nui_DepthFrameReady;
    _nui.VideoFrameReady += _nui_VideoFrameReady;

    // hook up our events for skeleton
    _nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(_nui_SkeletonFrameReady);

    // open the video stream at the proper resolution
    _nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
    _nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);

    // parameters used to smooth the skeleton data
    _nui.SkeletonEngine.TransformSmooth = true;
    TransformSmoothParameters parameters = new TransformSmoothParameters();
    parameters.Smoothing = 0.8f;
    parameters.Correction = 0.2f;
    parameters.Prediction = 0.2f;
    parameters.JitterRadius = 0.07f;
    parameters.MaxDeviationRadius = 0.4f;
    _nui.SkeletonEngine.SmoothParameters = parameters;

    //set camera angle
    _nui.NuiCamera.ElevationAngle = 17;
}
catch (System.Runtime.InteropServices.COMException)
{
    MessageBox.Show("Could not initialize Kinect device.\nExiting application.");
    _nui = null;

}

I am looking for a way for my app to not crash (the exception to be ignored) when kinect is not connected. I created another question here but the solutions could not be applied to my occasion as I am forced to use outdated sdk and nobody can solve that quesiton so I am trying to use a different approach. How can I ignore this exception? (I can reverse the changes made to _nui myself afterwards)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:20:52+00:00Added an answer on June 14, 2026 at 5:20 pm

    Currently you’re catching all of ComExceptions. If you want to catch other exceptions, you need to provide specific types for each exception.

    You can add your exception types after your catch block like this:

        catch (System.Runtime.InteropServices.COMException)
        {
            MessageBox.Show("Could not initialize Kinect device.\nExiting application.");
            _nui = null;
    
        } catch (Exception ex) //this will catch generic exceptions.
        {
    
        }  
    

    If you want your code to execute after catch No matter what. you can also try to use finally

    like this

    try
    {
      //logic
    }
    finally
    {
      //logic. This will be executed and then the exception will be catched
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm interested in writing some homebrew code for the Microsoft Kinect console. I have
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
Writing Junit Tests for my spring application. Because I am new at this I
Writing an iPhone app in Objective-C, I have a date in string form (in
I am writing a flash app for an LED floor using a Kinect to
Writing some classes for a Framework extension, and I have the following code: public
Writing a PHP app and have several classes that only have static methods (no
Writing Classic ASP code in JScript has a lot going for it: more humane
Writing documentation in html requires some code examples. What to do with characters that
Writing a python program, and I came up with this error while using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.