Skip to content

[codex] Fix release markdown rendering#86

Merged
zhuowcui merged 1 commit into
mainfrom
codex/fix-release-markdown-rendering
May 19, 2026
Merged

[codex] Fix release markdown rendering#86
zhuowcui merged 1 commit into
mainfrom
codex/fix-release-markdown-rendering

Conversation

@Xueyang-Song

Copy link
Copy Markdown
Collaborator

Summary

Fixes release-mode markdown previews rendering only the first visible block by avoiding an unconditional CanvasTextLayout.LineMetrics read during decoration drawing.

Root Cause

In Release/AOT, the WinRT projection can throw NotSupportedException while marshalling CanvasLineMetrics. The renderer fetched line metrics unconditionally in the inline decoration pass, even when the block did not need underline or strikethrough decoration. That exception aborted the tile paint after the first block, leaving headings and non-virtualized overlay controls visible while the rest of the markdown body was blank.

Changes

  • Lazily fetch line metrics only when a run actually needs decoration.
  • Fall back to character-region bounds when line metrics cannot be marshalled, so text keeps painting in Release.
  • Measure lazy layout against the CanvasVirtualControl paint region so requested tiles are realized before drawing.
  • Add an unpackaged release fallback for repo file cache storage so the published app can open repo-code markdown previews in this test path.

Validation

  • dotnet test MarkdownRenderer\MarkdownRenderer.Tests\MarkdownRenderer.Tests.csproj -c Debug -p:Platform=x64 --nologo passed: 292 tests.
  • dotnet build JitHub.WinUI\JitHub.WinUI.csproj -c Release -p:Platform=x64 --nologo succeeded.
  • dotnet publish JitHub.WinUI\JitHub.WinUI.csproj -c Release -p:Platform=x64 --no-restore --nologo succeeded with existing trim/AOT warnings.
  • Published Release app opened JitHubApp/JitHubV2 repo code page and rendered README.md in Rich mode with multiple markdown blocks visible.

@zhuowcui zhuowcui marked this pull request as ready for review May 19, 2026 07:36
@zhuowcui zhuowcui merged commit 4a83a22 into main May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants