Error Adding Gesture to VisualGestureBuilderFrameSource RRS feed

  • Question

  • Greetings,

    I'm working on a project and have been stuck for awhile. I was hoping somebody might be able to help out.

    The error I receive is "An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in Microsoft.Kinect.VisualGestureBuilder.dll" Additional information: This API has returned an exception from an HRESULT: 0x80070003

    My project is a windows forms application in Visual Studio 2013 Express for Desktop.

    Originally I created my own .gbd file and placed it in the bin folder of my project. To verify that the issue was not with my .gbd file, I added the seated.gbd file, which received the same error. I know it can find the .gbd file from examining the items in my VisualGestureBuilderDatabase object during debugging. It fails on vgbfs.AddGesture([variable containing my gesture name]).

    I would greatly appreciate any tips or suggestions.

    Wednesday, August 27, 2014 3:08 PM


  • Did you copy the required .dll's to your project build directory? Be sure to add the post build command

    xcopy "$(KINECTSDK20_DIR)Redist\VGB\$(Platform)\vgbtechs" "$(TargetDir)\vgbtechs" /S /R /Y /I
    Have a look at the DiscreetGestureBasics sample for the build settings.

    Carmine Sirignano - MSFT

    Wednesday, August 27, 2014 5:42 PM

All replies

  • Did you copy the required .dll's to your project build directory? Be sure to add the post build command

    xcopy "$(KINECTSDK20_DIR)Redist\VGB\$(Platform)\vgbtechs" "$(TargetDir)\vgbtechs" /S /R /Y /I
    Have a look at the DiscreetGestureBasics sample for the build settings.

    Carmine Sirignano - MSFT

    Wednesday, August 27, 2014 5:42 PM
  • Thanks for the suggestion.  It did seem to address the issue I had.

    I'm new to this, but I tried to add the post build command in VS Pro 2013.  It exited with code 4.

    Just to test, I manually copied the vgbtechs folder to the folder shown in the post build error message. 

    When I tried to build, it added the gesture to the vgbfs successfully, the kinect started, but after a few seconds I receive:

    "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

    Additional information: Exception has been thrown by the target of an invocation."

    My code was based off of an earlier sample posted about a month ago on the forum rather then the new Discrete Gesture Builder sample.  The newer one builds fine for me so I am just going to give that another look and go from there. 

    Thanks again for the help.

    Wednesday, August 27, 2014 11:18 PM
  • I still got the same error when I copied the required .dll's to my project's build directory.

    Stops at throw new InvalidOperationException(message, exceptionForHR);

    Even I delete the xcopy "$(KINECTSDK20_DIR)Redist\VGB\$(Platform)\vgbtechs" "$(TargetDir)\vgbtechs" /S /R /Y /I in the sample DiscreteGestureBasics, the sample runs correctly without showing any error. 

    Could you give some more detailed guidance for us? Thanks!

    Monday, September 15, 2014 1:43 AM
  • Bruce,

    I am sure someone else can answer better, but I think it might require Visual Studio Professional or higher rather than Express to create Post-Build commands. 

    Are you using Express?  If so, I wonder if it only shows the Post-Build command as Read-Only and that is why it is not deleting.

    For what it is worth, I gave up on building my own from scratch and based my project off the Discrete Gesture sample.  I heard post-build commands can exit in code 4 for many reasons and moved on.

    I think the "An unhandled exception of type 'System.Reflection.TargetInvocationException'..." error I got stuck on might have been because I wasn't disposing of frames right.  I don't recall seeing your specific error.

    Manually copying vgbtechs to the build directory got me past this error: "An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in Microsoft.Kinect.VisualGestureBuilder.dll..."

    Good Luck.

    • Edited by GMI_DPG Monday, September 15, 2014 2:33 AM
    Monday, September 15, 2014 1:59 AM
  • I solve this problem by firstly using the full path of the database. Secondly, attaching the TrackingID for vgbFrameSource from the BodyFrame and thirdly set the vgbFrameReader.IsPaused to false after the body frames. 

    I think its a matter of following the way that VisualGestureBuilder works.

    Any way, thanks for your reply. All the Best!

    Monday, September 15, 2014 9:28 AM
  • Hi,

    I have the same issue (build public 14/09) :

    I have following structure:
    => my.dll
    => *Kinect*.dll
    => /database/my.gbd
    => /vgbtechs/*

    - Setting fullpath didn't solve
    - Setting isPaused to false didn't solve

    I don't understand what folder it is looking for (nothing in the exception). And I don't understand Why it crash on AddGesture() is it because it looks for vgbtechs ?

    EDIT: Ok I fixed it ! Using Assembly.GetEntryAssembly().Location I found where to put vgbtechs folder. The other *kinect*.dll must be in same folder than to my.dll

    • Edited by Jp EncausseMVP Sunday, October 12, 2014 8:33 PM Answer the issue
    Sunday, October 12, 2014 5:00 PM
  • Hi,

    I solved the problem by copying files from folder vgbtechs in Microsoft SDKs (in my computer the path is: C:\Program Files\Microsoft SDKs\Kinect\v2.0_1409\Redist\VGB\x86\vgbtechs) to created folder vgbtechs in my project in folder Debug/Release. I chose x86 because my project target CPU was set to x86!. Try to change target to x86 or x64 and copy files from appropriate folder. 

    Good Luck.

    Tuesday, February 24, 2015 12:28 AM