Issue when batch-creating multiple SDLTBs programmatically with MultiTerm 2021 SR2 (16.2.1.1044) API: System.Runtime.InteropServices.COMException (0x800A0E7D)

Dear MultiTerm Developers

We have written a converter which transforms multilingual MFT XML file into several SDLTB containing only one language pair from the XML. In most instances it will run smothly but sometimes the program runs in an error as you can see below (log file entries).

It is not foreseeable when the error will occur. It can happen while generating any of the SDLTBs. The program then will not recover from the error and  will not generate any SDLTB until it ends. If the program is started again, it begins to create SDLTBs without an error.

My question is if you are familliar with this error type and do you have an advice how to handle it?

I can share more the code if needed.

Code:

if (!application.LocalRepository.IsConnected)
{
application.LocalRepository.Connect(string.Empty, string.Empty);
}

WriteLog("Multiterm connected.");

Termbase termbase = null;

try
{
WriteLog("Multiterm try create " + sdltbNameInternal + " with " + termXDTFile + " to " + sdltbNameFull);
termbase = application.LocalRepository.Termbases.New(sdltbNameInternal, "", termXDTFile, sdltbNameFull);
WriteLog("Multiterm " + sdltbNameInternal + " opened from " + sdltbNameFull);


XPathDocument termXML = new XPathDocument(WORK_FOLDER + lang + ".xml");
XPathNavigator termNavigator = termXML.CreateNavigator();
XPathExpression termExpression = termNavigator.Compile("count(//conceptGrp)");
string nodesCount = termNavigator.Evaluate(termExpression).ToString();


ImportDefinition importDefinition = termbase.ImportDefinitions.Add("sew import definition " + lang, "", termXDIFile);
WriteLog("Multiterm import definition loaded " + termXDIFile);

WriteLog("Multiterm start import with " + termXDTFile + " " + termXDIFile + " to " + sdltbNameFull + " (" + nodesCount + " conceptGrp)");
importDefinition.ProcessImport(MtTaskType.mtScript);

WriteLog("Multiterm import finished with " + termbase.Entries.Count + " entries imported.");

termbase.Close();


if (!File.Exists(sdltbNameFull))
{
WriteLog("ERROR: " + sdltbNameFull + " could not be created!");

continue;
}

Error in the log file:

2024-01-20 00:39:02 15/28: Creating E:\_termDB\work\abc_de-DE_lt-LT_1031_1063.sdltb
2024-01-20 00:39:02 Multiterm connected.
2024-01-20 00:39:02 Multiterm try create abc_de-DE_lt-LT_1031_1063 with E:\_termDB\work\LT.xdt to E:\_termDB\work\abc_de-DE_lt-LT_1031_1063.sdltb
2024-01-20 00:39:03 Multiterm abc_de-DE_lt-LT_1031_1063 opened from E:\_termDB\work\abc_de-DE_lt-LT_1031_1063.sdltb
2024-01-20 00:39:04 Multiterm import definition loaded E:\_termDB\work\LT.xdi
2024-01-20 00:39:04 Multiterm start import with E:\_termDB\work\LT.xdt E:\_termDB\work\LT.xdi to E:\_termDB\work\abc_de-DE_lt-LT_1031_1063.sdltb (7379 conceptGrp)
2024-01-20 00:46:24 MULTITERM ERROR: System.Runtime.InteropServices.COMException (0x800A0E7D): Requested operation requires an OLE DB Session object, which is not supported by the current provider.
at Sdl.MultiTerm.TMO.Interop.IEntries.get_Count()
at XML2SDLTB..ctor() in C:\VSPROJECTS\XML2SDLTB\___VS-Projekt\XML2SDLTB\XML2SDLTB\XML2SDLTB.cs:line 315
2024-01-20 00:46:24 16/28: Creating E:\_termDB\work\abc_de-DE_lv-LV_1031_1062.sdltb
2024-01-20 00:46:24 Multiterm connected.
2024-01-20 00:46:24 Multiterm try create abc_de-DE_lv-LV_1031_1062 with E:\_termDB\work\LV.xdt to E:\_termDB\work\abc_de-DE_lv-LV_1031_1062.sdltb
2024-01-20 00:46:24 MULTITERM ERROR: System.Runtime.InteropServices.COMException (0x80040244): MultiTerm is unable to create the termbase.
Unspecified error
at Sdl.MultiTerm.TMO.Interop.ITermbases.New(String TermbaseName, String Description, String TermbaseDefinitionFile, String TermbaseDestinationFilePath)
at XML2SDLTB..ctor() in C:\VSPROJECTS\XML2SDLTB\___VS-Projekt\XML2SDLTB\XML2SDLTB\XML2SDLTB.cs:line 299
2024-01-20 00:46:24 17/28: Creating E:\_termDB\work\abc_de-DE_nb-NO_1031_1044.sdltb
2024-01-20 00:46:24 Multiterm connected.
2024-01-20 00:46:24 Multiterm try create abc_de-DE_nb-NO_1031_1044 with E:\_termDB\work\NO-NO.xdt to E:\_termDB\work\abc_de-DE_nb-NO_1031_1044.sdltb
2024-01-20 00:46:24 MULTITERM ERROR: System.Runtime.InteropServices.COMException (0x80040244): MultiTerm is unable to create the termbase.
Unspecified error
at Sdl.MultiTerm.TMO.Interop.ITermbases.New(String TermbaseName, String Description, String TermbaseDefinitionFile, String TermbaseDestinationFilePath)
at XML2SDLTB..ctor() in C:\VSPROJECTS\XML2SDLTB\___VS-Projekt\XML2SDLTB\XML2SDLTB\XML2SDLTB.cs:line 299

Parents
  • Now that we have migrated the code of our converter to run with the API of MultiTerm 2022 SR1 we have the very same issue with this version, too.
    Any helpfull anser is welcome.
    kr
    Victor

  • Hi  , and  

    What can I do to avoid the error described above? It appears randomly after generating one or more termbases. Error happens when trying to create a termbase, see code sample at line 4. The input files or amount of entries are not the reason for the issue, as the converter often creates the desired termbase if started again. 

    Kind regards

    Victor

     try
                    {
                        WriteLog("Multiterm try create " + sdltbNameInternal + " with " + termXDTFile + " to " + sdltbNameFull);
                        termbase = application.LocalRepository.Termbases.New(sdltbNameInternal, "", termXDTFile, sdltbNameFull);
                        WriteLog("Multiterm " + sdltbNameInternal + " opened from " + sdltbNameFull);
    
    
                        XPathDocument termXML = new XPathDocument(WORK_FOLDER + lang + ".xml");
                        XPathNavigator termNavigator = termXML.CreateNavigator();
                        XPathExpression termExpression = termNavigator.Compile("count(//conceptGrp)");
                        string nodesCount = termNavigator.Evaluate(termExpression).ToString();
    
    
                        ImportDefinition importDefinition = termbase.ImportDefinitions.Add("sew import definition " + lang, "", termXDIFile);
                        WriteLog("Multiterm import definition loaded " + termXDIFile);
    
                        WriteLog("Multiterm start import with " + termXDTFile + " " + termXDIFile + " to " + sdltbNameFull + " (" + nodesCount + " conceptGrp)");
                        importDefinition.ProcessImport(MtTaskType.mtScript);
    
                        WriteLog("Multiterm import finished with " + termbase.Entries.Count + " entries imported.");
    
                        termbase.Close();
    
    
                        if (!File.Exists(sdltbNameFull))
                        {
                            WriteLog("ERROR: " + sdltbNameFull + " could not be created!");
    
                            continue;
                        }
    
                        WriteLog("Copying " + sdltbNameFull + " to " + sdltbNameFinal);
                        File.Copy(sdltbNameFull, sdltbNameFinal, true);
                    }
                    // catch (COMException e2)
                    catch (Exception e2)
                    {
                        WriteLog("MULTITERM ERROR: " + e2.ToString());
                        continue;
                    }
                    finally
                    {
                        if (termbase != null)
                        {
                            termbase.Close();
                        }
                    }

Reply
  • Hi  , and  

    What can I do to avoid the error described above? It appears randomly after generating one or more termbases. Error happens when trying to create a termbase, see code sample at line 4. The input files or amount of entries are not the reason for the issue, as the converter often creates the desired termbase if started again. 

    Kind regards

    Victor

     try
                    {
                        WriteLog("Multiterm try create " + sdltbNameInternal + " with " + termXDTFile + " to " + sdltbNameFull);
                        termbase = application.LocalRepository.Termbases.New(sdltbNameInternal, "", termXDTFile, sdltbNameFull);
                        WriteLog("Multiterm " + sdltbNameInternal + " opened from " + sdltbNameFull);
    
    
                        XPathDocument termXML = new XPathDocument(WORK_FOLDER + lang + ".xml");
                        XPathNavigator termNavigator = termXML.CreateNavigator();
                        XPathExpression termExpression = termNavigator.Compile("count(//conceptGrp)");
                        string nodesCount = termNavigator.Evaluate(termExpression).ToString();
    
    
                        ImportDefinition importDefinition = termbase.ImportDefinitions.Add("sew import definition " + lang, "", termXDIFile);
                        WriteLog("Multiterm import definition loaded " + termXDIFile);
    
                        WriteLog("Multiterm start import with " + termXDTFile + " " + termXDIFile + " to " + sdltbNameFull + " (" + nodesCount + " conceptGrp)");
                        importDefinition.ProcessImport(MtTaskType.mtScript);
    
                        WriteLog("Multiterm import finished with " + termbase.Entries.Count + " entries imported.");
    
                        termbase.Close();
    
    
                        if (!File.Exists(sdltbNameFull))
                        {
                            WriteLog("ERROR: " + sdltbNameFull + " could not be created!");
    
                            continue;
                        }
    
                        WriteLog("Copying " + sdltbNameFull + " to " + sdltbNameFinal);
                        File.Copy(sdltbNameFull, sdltbNameFinal, true);
                    }
                    // catch (COMException e2)
                    catch (Exception e2)
                    {
                        WriteLog("MULTITERM ERROR: " + e2.ToString());
                        continue;
                    }
                    finally
                    {
                        if (termbase != null)
                        {
                            termbase.Close();
                        }
                    }

Children
No Data