dotnet/wpf · error · ArgumentException
SR.SelectionDoesNotResolveToAPage (end)
Error message
SR.SelectionDoesNotResolveToAPage (end)
What it means
ArgumentException from FixedTextSelectionProcessor.GetSelectedNodes: the selection's end point cannot be resolved to a fixed-document page (the page lookup for segment.End failed), so the end of the selection does not map to any FixedPage.
Solutions
- Verify the selection lies within a fixed document and pagination has completed before processing
- Trim the selection to a segment whose end resolves to a page
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/FixedTextSelectionProcessor.cs:106 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/9a871f983cf7b936.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/FixedTextSelectionProcessor.cs:106
IList<DependencyObject> pageEl = new List<DependencyObject>();
Point start;
Point end;
foreach (TextSegment segment in textSegments)
{
int startPage = int.MinValue;
ITextPointer startPointer = segment.Start.CreatePointer(LogicalDirection.Forward);
TextSelectionHelper.GetPointerPage(startPointer, out startPage);
start = TextSelectionHelper.GetPointForPointer(startPointer);
if (startPage == int.MinValue)
throw new ArgumentException(SR.Format(SR.SelectionDoesNotResolveToAPage, "start"), nameof(selection));
int endPage = int.MinValue;
ITextPointer endPointer = segment.End.CreatePointer(LogicalDirection.Backward);
TextSelectionHelper.GetPointerPage(endPointer, out endPage);
end = TextSelectionHelper.GetPointForPointer(endPointer);
if (endPage == int.MinValue)
throw new ArgumentException(SR.Format(SR.SelectionDoesNotResolveToAPage, "end"), nameof(selection));
int firstPage = pageEl.Count;
int numOfPages = endPage - startPage;
Debug.Assert(numOfPages >= 0, "start page number is bigger than the end page number");
// If the first page of this segment already has an FPP, then use that one for an additional segment
int i = 0;
if (pageEl.Count > 0 && ((FixedPageProxy)pageEl[pageEl.Count - 1]).Page == startPage)
{
firstPage--; // use the existing one from the list as the first
i++; // make 1 fewer FPPs
}
for (; i <= numOfPages; i++)
{
pageEl.Add(new FixedPageProxy(segment.Start.TextContainer.Parent, startPage + i));View on GitHub (pinned to 81131a70a4)