Bug in TQA generation

Hi! I found a bug in the Translation Quality Assessment Batch processor. The bug is present in Trados Studio 2019 and 2021.

We have a customer who created a project (from a DOCX document) where they were instructed to use the MQM project template (so standard...) which was then pre-translated using an MT system and then the customer performed error annotation (using TQA).

It seems that if the annotations (TQAs) in the source segment, which can be added in the TQA pop-up, are touching the beginning or the end of a segment (i.e., the span is either from the first symbol or till the last symbol including; I did not check which or both conditions must apply) Trados Studio fails at generating the TQA report with the following error.

<SDLErrorDetails time="7/7/2021 11:20:27">
<ErrorMessage>Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index</ErrorMessage>
<Exception>
<Type>System.ArgumentOutOfRangeException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
<ParamName>index</ParamName>
<HelpLink />
<Source>mscorlib</Source>
<HResult>-2146233086</HResult>
<StackTrace><![CDATA[ at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Sdl.ProjectApi.AutomaticTasks.Feedback.FeedbackProcessor.GetSourceContentSelectionItems(ISegmentPair segPair, SegmentFeedbacks currentSegmentFeedback)
at Sdl.ProjectApi.AutomaticTasks.Feedback.FeedbackProcessor.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Core.Utilities.BilingualApi.BilingualContentHandlerAdapter.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.BilingualApi.AbstractBilingualContentProcessor.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Filters.Processors.SegmentRenumberingBilingualProcessor.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Core.Utilities.BilingualApi.BilingualContentHandlerAdapter.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Core.Utilities.BilingualApi.BilingualContentHandlerAdapter.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Integration.AbstractBilingualProcessorContainer.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.BilingualApi.AbstractBilingualContentProcessor.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Integration.LocationMarkerLocator.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Integration.AbstractBilingualProcessorContainer.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Integration.FileExtractor.ProcessParagraphUnit(IParagraphUnit paragraphUnit)
at Sdl.FileTypeSupport.Framework.Core.Utilities.BilingualApi.ParagraphUnitBuffer.ProcessParagraphUnit(IParagraphUnit pu)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.OutputParagraphUnit(IParagraphUnit pu)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseLocalizableParagraphUnit(transunit transunit, LockTypeFlags lockFlags)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseTransUnit(transunit transunit)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseGroup(group group)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.OnGroup(XmlElement group)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.SdlXliffFeeder.<ContinueScanning>b__14_11(ISdlXliffStreamContentHandler handler)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.SdlXliffFeeder.ContinueScanning()
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ContinueParsing()
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.FileExtractor.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.MultiFileConverter.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.MultiFileConverter.Parse()
at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.Parse(String targetFilePath)]]></StackTrace>
</Exception>
<Environment>
<ProductName>SDL Trados Studio</ProductName>
<ProductVersion>Studio16</ProductVersion>
<EntryAssemblyFileVersion>16.0.1.2917</EntryAssemblyFileVersion>
<OperatingSystem>Microsoft Windows 10 Pro</OperatingSystem>
<ServicePack>NULL</ServicePack>
<OperatingSystemLanguage>1033</OperatingSystemLanguage>
<CodePage>1252</CodePage>
<LoggedOnUser>...</LoggedOnUser>
<DotNetFrameWork>4.0.30319.42000</DotNetFrameWork>
<ComputerName>...</ComputerName>
<ConnectedToNetwork>True</ConnectedToNetwork>
<PhysicalMemory>16511268 MB</PhysicalMemory>
</Environment>
</SDLErrorDetails>

When I manually go through the TQAs and remove the source selections from the "affected" annotations, the TQA report generates normally. I.e., hence a bug...