Error on calling ProcessSegmentPairs

Hi,

I'm trying the manipulate segments with ProcessSegmentPairs, but I always get the following exception in Studio 2015 12.0.4996.3:

System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
at Sdl.TranslationStudio.Editor.AbstractActiveRangeAction.IsActionEnabled()
at Sdl.TranslationStudio.Api.Editor.AbstractActiveDocumentAction.UpdateAction()
at Sdl.TranslationStudio.Editor.AbstractActiveRangeAction.sideBySideEditor_Target_Entered(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WmSetFocus(Message& m)
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)

And then immediately another one:

System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

at Sdl.TranslationStudioAutomation.IntegrationApi.Document.ProcessSegment(String processingName, ISegmentContainerNode segmentContainerNode, Action`2 process)
at Sdl.TranslationStudioAutomation.IntegrationApi.Document.ProcessSegmentPairs(String processingName, Action`2 process)
at Kaleidoscope.SmartQuery.Plugin.Utility.SmartQueryDataHandlerV2.SavePostedQueryInformation(Int32 queryId)

This is all I try to do at the moment:

if (editorController != null && editorController.ActiveDocument != null)
editorController.ActiveDocument.ProcessSegmentPairs(SmartDataTagOperationName, (pair, args) =>
{
});

The strange is that the same works in Studio2014. Can you please help?

thanks,

Tamas

Parents Reply
  • Hello,

    I'm experiencing the same problem. With version 12.2.4961.2 (Service Release 1) the ProcessSegmentPairs method works. When I install cumulative update 3 (released on 16 December 2015 - version 12.0.4996.3) I get the same error message as Tamás.

    The knowledge base article on Cumulative Update 3 mentions the following fix:

    Fixed issue with the UpdateSegmentPair command in the Studio Integration API.

    The UpdateSegmentPair command is a method of the Document Class (Integration API) like the ProcessSegmentPairs method. Is there a link?

    As I'm using the UpdateSegmentPair method as well I would be interested in some more information about what has been fixed. When I use this method in version 12.2.4961.2 I cannot apply it on virtually merged files (several documents opened in the same Editor tab). Doing so results in unwanted side effects (segment numbering for each document starts at 1 meaning that several segments have the same Id; the UpdateSegmentPair method updates all segments with the same Id).

    However, my main interest would be to have a solution for the ProcessSegmentPairs method in version 12.0.4996.3 (and later).

    Best,

    Thomas

    PS: my environment: Windows 7, Visual Studio 2013; plugin compiled with .NET 4.5.2, Platform target: Any CPU.
Children