Multiple custom terminology provider throws "Sequence contains more than one matching element"

Hi Everyone,

Developing a custom terminology provider and we have noticed that if we add multiple provider, then on opening any file for editing, we get an "Sequence contains more than one matching element" (see full stack trace in attached XML).

The provider's name are different that's for sure. The project termbase settings look like this (see attached txt document). So the termbase name seems unique as well. Regarding the provider, we have a constructor, which expect an URI (the same URI, that ITerminologyProviderFactory.CreateTerminologyProvider receives from studio), from which the extract the name of the termbase/provider

I am not sure, what we do wrong here. Decompiling studio API, we only see that it is using the termbase's names and provider's name in that function, from where the error comes, so we don't see how it can throw and error if the names are unique. Can you help us figure out, whar we are missing? Thank you for your help in advance.

Best regards,

Balazs

1
2
3
4
5
6
7
<SDLErrorDetails time="2022. 12. 09. 9:07:00">
<ErrorMessage>Sequence contains more than one matching element</ErrorMessage>
<Exception>
<Type>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
<HelpLink />
<Source>System.Core</Source>
<HResult>-2146233079</HResult>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
<SettingsGroup Id="TerminologyProviderSettings">
<Setting Id="TermbasesOrder">
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<string>Kalcium (Dokumentation/ZZ_Kalcium_640+)</string>
<string>Kalcium (Dokumentation/ZZ_Kalcium_Dokumentation)</string>
<string>Printer Termbase</string>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

emoji
  • Hi  , there is nothing in the API that is stopping you from adding multiple custom terminology providers to the project. 

    However they need to be sufficienly different, so far as they should have a different assembly name, provider id, name and if you have actions, then they should have different groups and ids. I would also use a different ns + update the package manifest...  etc... 
    I don't know if your persisted storage is an API endpoint or a resource file on your network, but worth mentioning that it should support sharing if you are now accessing it from multiple providers...
    I would also recommend to uniquely identify the provider with the scheme; both are using 'kalcium.terminology://'
    You need to remember that the plugin framework will attempt to register your plugin + actions in to the Trados Studio context and is unforgiving when it see duplicate ids.

    If you can't locate where it is getting stuck, then I would recommend to create a new project from scratch and copy in the code from the duplicate project.

    emoji
  • There is a misunderstanding here. I want to add multiple instance of the same custom terminology provider. Also I don't want to stop adding multiple instance of the same custom terminology provider. The problem is that there is an error from Trados, if i add more terminology provider from the same type, even though the instance's URI and name are unique. 

    So I have a custom terminology provider. On adding this provider the user chooses a termbase from the remote service (lets assume that the termbase names are unique), based on which the following URI us generated : "very.sample://SOME-URL#####SOME-TERMBASE-NAME" . You can add multiple instance from this provider for different termbases. When the AbstractTerminologyProvider receives this URI, it extract the unique termbase name and it uses that witha prefix as the provider's name (like: "Very sample provider (termbase name)". You can see this from the copied project settings part (those are "real" test data from the actual implementation)

    Yet the error  "Sequence contains more than one matching element" comes (see at my initial question)

    emoji
  • I want to add multiple instance of the same custom terminology provider.

    Hi  , it doesn't seem to be supported for tb providers with the API.  You could however allow the user to select multiple databases from a single provider, by extending the settings; similar to the Multitrans terminology provider integration.

    emoji
  • I beleive we are speaking about the same: Adding a custom terminology provider with different termbase settings to the same project (so multiple instances of the same object with different settings).

    For reproduction updated the github repro (https://github.com/eurocombfeher/SampleProvider ). Use the plugin for Studio 2022

    1. Open a project, then add a "Very sample" provider, then make it default
    2. Add another "Very Sample" provider and make it default as well (I am not sure both should be the top 2 provider, but i am sureone should be set as default)
    3. Save the project
    4. Restart studio
    5. Open any file inside the project
    6. On opening the file, you will get that "Sequence contains more than one matching element" error
    emoji
  • I wonder if you had the chance to check the repo with reproduction steps

    emoji
  • Hi  , sorry for not getting back to you with this issue. I have escalated this issue to the development team to review and respond.

    Internal tracking nr. SRQ-23329, CRQ-35231

    Tech Notes:

    I have been able to reproduce the same exception as described by the user using the sample project.  When more than one termbase is added to the project, then the exeption is thrown.  The question that the development team will need to answer is if this is supported for termbases.  If yes, then why isn't it working as expected given the sample project from the user.

    ...