Merging segments fails with MT plugin enabled

When running our machine translation plugin (TextShuttle AI Translation https://appstore.rws.com/Plugin/145), when merging certain segments, we get an error "Object reference not set to an instance of an object." and the segments to be merged disappear.

We tried debugging the error, but couldn't locate the underlying issue yet. Here's some more details:

  • The issue happens in all Trados Studio versions (tested in Trados Studio 2021 and 2022)
  • The error doesn't happen in the plugin code itself. That's why debugging is extremely tedious. (The breakpoints are never reached)
  • Without MT, or with other providers (e.g. DeepL) the problem does not occur.
  • Merging only fails when interactively translating. If the file has already been pre-translated (as a batch task), the problem does not occur.
  • Only merging very specific segments causes the problem.

Here's a screen recording of the issue:

And here's the full stack trace of the error:

FATAL [2023-06-06 11:17:52,690] Sdl.Desktop.Platform.UnhandledException - Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Sdl.TranslationStudio.Editor.TranslationEditor.TranslatableDocument.GenerateTranslationRequest(ISegmentContainerNode segmentContainerNode)
   at Sdl.TranslationStudio.Editor.TranslationEditor.TranslateSegmentWorker.Translate()
   at Sdl.TranslationStudio.Editor.TranslationEditor.TranslatableDocument.TranslateSegment(ISegmentContainerNode segmentNode, ITranslatorFactory translatorFactory)
   at Sdl.TranslationStudio.Editor.TranslationEditor.SideBySideDocumentEditingView.TranslateActiveSegment()
   at Sdl.TranslationStudio.Editor.TranslationEditor.SideBySideDocumentEditingView.TryTranslateActiveSegment()
   at Sdl.TranslationStudio.Editor.TranslationEditor.Actions.MergeSegmentsAction.Execute()
   at Sdl.Desktop.Platform.Implementation.CommandBars.SimpleActionExecuter.Execute(ActionData actionData)
   at Sdl.Desktop.Platform.Implementation.ResourceLoggingInternalCommandExecuter`1.ExecuteWithResourceLogging(TCommandData commandData, String message)
   at Sdl.Desktop.Platform.Implementation.CommandBars.ActionService.ExecuteAction(IAction action, ActionOrigin origin, Boolean allowToggle)
   at Sdl.Desktop.Platform.WinForms.IgCommandBarAction.Execute()
   at Sdl.Desktop.Platform.WinForms.IgCommandBarAction._lazyButtonTool_ToolClick(Object sender, ToolClickEventArgs e)
   at Infragistics.Win.UltraWinToolbars.ToolBase.OnToolClick(ToolClickEventArgs e)
   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnToolClick(ToolClickEventArgs e)
   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.FireEvent(ToolbarEventIds id, EventArgs e)
   at Infragistics.Win.UltraWinToolbars.ToolBase.OnToolClick()
   at Infragistics.Win.UltraWinToolbars.ToolMenuItem.OnClick()
   at Infragistics.Win.UltraWinToolbars.PopupMenuItemUIElement.DoClickProcessing(MouseEventArgs e)
   at Infragistics.Win.UltraWinToolbars.PopupMenuItemUIElement.OnMouseUp(MouseEventArgs e)
   at Infragistics.Win.TextUIElementBase.OnMouseUp(MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseUpHelper(Object sender, MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseUp(Object sender, MouseEventArgs e)
   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
   at Infragistics.Win.UltraWinToolbars.PopupControlBase.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Do you have any pointers on how our plugin could break the merging of segments?

emoji