RSS

‘System.Reflection.TargetInvocationException’ in Speech recognition

17 Sep

The following reason may cause the captioned exception, i.e. ‘System.Reflection.TargetInvocationException’. Try and see if:

  • A string, esp. the recognized word is empty or null before using it:
    !string.IsNullOrEmpty(SpokenWords)
    {
    if(SpokenWords.Contains())
    WhatYouDoHere();
    }

    If this exception occurs in the same thread as the main thread, the exception will explicitly pop up and note you of this, but in the speech recognition, when you run _SRE.RecognizeAsync(RecognizeMode.Multiple); the recognition will run in a seperate thread, and in this execution, the ‘System.Reflection.TargetInvocationException’ will be thrown.

Advertisements
 
1 Comment

Posted by on September 17, 2008 in CAD

 

One response to “‘System.Reflection.TargetInvocationException’ in Speech recognition

  1. xinyustudio

    September 30, 2008 at 4:17 pm

    Another most possible reason is perhaps due to the cross thread calling of GUI update, a simple resolution is to disable such exceptions in debug mode:

    #if DEBUG System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = false;
    #endif

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: