"Exception has been thrown by the target of an invocation." following the Sample Translation Service Provider Plug-in example

Hi all, 

I'm following the Sample Translation Service Provider Plug-in example and I got an "Exception has been thrown by the target of an invocation." error at MyTranslationProviderWinFormsUI.get_TypeName() when I create a new project, add a file and click on "Next".

I'm using SDL Trados 2017 with Visual Studio 2017.

I have no idea why, if someone can help me please.

Thanks, 

Matthieu

Parents
  • Hi Matthieu,

    I have come across this error usually when trying to update/access form controls from within an asynchronous method, i.e. from a non-UI thread.

    Please show the exact portion of code that throws the error.

    Best

    Andreas

  • Hi Andreas, 

    I'm a beginner in C# and SDL Trados API development so I am maybe wrong but it seems that this portion throws the error : 

    namespace SDL_Translation_Provider2
    {
    [TranslationProviderWinFormsUi(Id = "Translation_Provider_Plug_inWinFormsUI",
    Name = "Translation_Provider_Plug_inWinFormsUI",
    Description = "Translation_Provider_Plug_inWinFormsUI")]
    class MyTranslationProviderWinFormsUI : ITranslationProviderWinFormsUI
    {
    #region ITranslationProviderWinFormsUI Members

    public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public bool GetCredentialsFromUser(IWin32Window owner, Uri translationProviderUri, string translationProviderState, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public TranslationProviderDisplayInfo GetDisplayInfo(Uri translationProviderUri, string translationProviderState)
    {
    throw new NotImplementedException();
    }

    public bool SupportsEditing
    {
    get { throw new NotImplementedException(); }
    }

    public bool SupportsTranslationProviderUri(Uri translationProviderUri)
    {
    throw new NotImplementedException();
    }

    public string TypeDescription
    {
    get { throw new NotImplementedException(); }
    }

    public string TypeName
    {
    get { throw new NotImplementedException(); }
    }

    #endregion
    }
    }

Reply
  • Hi Andreas, 

    I'm a beginner in C# and SDL Trados API development so I am maybe wrong but it seems that this portion throws the error : 

    namespace SDL_Translation_Provider2
    {
    [TranslationProviderWinFormsUi(Id = "Translation_Provider_Plug_inWinFormsUI",
    Name = "Translation_Provider_Plug_inWinFormsUI",
    Description = "Translation_Provider_Plug_inWinFormsUI")]
    class MyTranslationProviderWinFormsUI : ITranslationProviderWinFormsUI
    {
    #region ITranslationProviderWinFormsUI Members

    public ITranslationProvider[] Browse(IWin32Window owner, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public bool GetCredentialsFromUser(IWin32Window owner, Uri translationProviderUri, string translationProviderState, ITranslationProviderCredentialStore credentialStore)
    {
    throw new NotImplementedException();
    }

    public TranslationProviderDisplayInfo GetDisplayInfo(Uri translationProviderUri, string translationProviderState)
    {
    throw new NotImplementedException();
    }

    public bool SupportsEditing
    {
    get { throw new NotImplementedException(); }
    }

    public bool SupportsTranslationProviderUri(Uri translationProviderUri)
    {
    throw new NotImplementedException();
    }

    public string TypeDescription
    {
    get { throw new NotImplementedException(); }
    }

    public string TypeName
    {
    get { throw new NotImplementedException(); }
    }

    #endregion
    }
    }

Children