{"record":{"id":"7133507c507ad5c1","repo":"dotnet/wpf","slug":"sr-sidewaysrtltextisnotsupported","errorCode":null,"errorMessage":"SR.SidewaysRTLTextIsNotSupported","messagePattern":"SR\\.SidewaysRTLTextIsNotSupported","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/GlyphRun.cs","lineNumber":415,"sourceCode":"                        {\n                            throw new ArgumentException(SR.Format(SR.CollectionNumberOfElementsShouldBeEqualTo, characters.Count), nameof(clusterMap));\n                        }\n                    }\n                    else\n                    {\n                        if (GlyphCount != characters.Count)\n                            throw new ArgumentException(SR.Format(SR.CollectionNumberOfElementsShouldBeEqualTo, GlyphCount), nameof(clusterMap));\n                    }\n                }\n\n                if (caretStops != null && caretStops.Count != 0)\n                {\n                    if (caretStops.Count != CodepointCount + 1)\n                        throw new ArgumentException(SR.Format(SR.CollectionNumberOfElementsShouldBeEqualTo, CodepointCount + 1), nameof(caretStops));\n                }\n\n                if (isSideways && (bidiLevel & 1) != 0)\n                    throw new ArgumentException(SR.SidewaysRTLTextIsNotSupported);\n\n                // NOTE:  In previous versions this function would estimate the size\n                // of this glyph run's bitmaps and compare it against the theoretical\n                // maximum size allowed before rendering falls back to using geometry.\n                // This was done in order to produce a managed exception where we might\n                // hit overflow or memory allocation issues in native code.\n                // We no longer own the code the produces these bitmaps so we can't reliably\n                // avoid the issue here any longer.\n            }\n            else\n            {\n                ArgumentOutOfRangeException.ThrowIfEqual(renderingEmSize, double.NaN);\n                ArgumentOutOfRangeException.ThrowIfNegative(renderingEmSize);\n                ArgumentNullException.ThrowIfNull(glyphTypeface);\n                ArgumentNullException.ThrowIfNull(glyphIndices);\n\n                if (glyphIndices.Count <= 0)\n                    throw new ArgumentException(SR.CollectionNumberOfElementsMustBeGreaterThanZero, nameof(glyphIndices));","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/GlyphRun.cs#L397-L433","documentation":"GlyphRun.Initialize rejects runs that are both sideways (isSideways == true) and right-to-left (bidiLevel odd), because sideways vertical layout of RTL text is not supported by the underlying text stack. It throws ArgumentException (no parameter name).","triggerScenarios":"Calling the GlyphRun constructor, TryCreate, or EndInit with isSideways=true and bidiLevel % 2 == 1, e.g. vertical Arabic or Hebrew text requested as sideways glyphs.","commonSituations":"East-Asian vertical layout code paths applied to RTL scripts; copying sideways=true from a Latin vertical-text implementation into an RTL run.","solutions":["Pass isSideways=false for RTL (odd bidiLevel) runs","Normalize the run so bidiLevel is even if sideways rendering is required","Split mixed-direction text into separate runs with appropriate flags"],"exampleFix":"// before\nnew GlyphRun(tf, bidiLevel: 1, isSideways: true, ...);\n// after\nnew GlyphRun(tf, bidiLevel: 1, isSideways: false, ...); // RTL cannot be sideways","handlingStrategy":"validation","validationCode":"if (isSideways && (bidiLevel & 1) != 0)\n    throw new InvalidOperationException(\"Sideways RTL is unsupported; set isSideways=false\");","typeGuard":"static bool IsSupportedOrientation(bool isSideways, int bidiLevel) => !isSideways || (bidiLevel & 1) == 0;","tryCatchPattern":"try { var run = new GlyphRun(...); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"sideways\") || ex.Message.Contains(\"Sideways\")) { /* retry non-sideways */ }","preventionTips":["Default isSideways=false for RTL scripts","Split bidi runs before applying vertical/sideways layout","Gate sideways paths behind script detection"],"tags":["wpf","glyphrun","bidi","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}