Repository navigation
Conversation
eXpl0it3r
force-pushed
the
feature/async-naming
branch
from
November 26, 2026 20:49
84b0e96 to
69d2153
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
2.0 is a bit mixed at the moment:
HtmlRender.RenderAsync,MeasureAsyncetc. andSetTextAsynchave the suffix, whileHtmlContainer.SetHtml,PdfGenerator.GeneratePdfand the adapter's network API return aTaskwithout it. As such every public method returning aTasknow gets theAsyncsuffix, which is still what the TAP guidance and the BCL do for libraries:SetHtmlbecomesSetHtmlAsynconHtmlContainerIntand the WinForms, WPF, WinUI and PdfSharp containersPdfGenerator.GeneratePdfandAddPdfPagesbecomeGeneratePdfAsyncandAddPdfPagesAsyncRNetworkLoader.GetPrimaryContentsandGetResourceStreambecomeGetPrimaryContentsAsyncandGetResourceStreamAsyncRAdapter.GetResourceStreamandAddFontFacebecomeGetResourceStreamAsyncandAddFontFaceAsync1.5 and 1.6 had no public method returning a
Task, so none of the old names ever returned one in a release. Since the return type changes with 2.0 anyway,[Obsolete]forwarders wouldn't keep anyone's code compiling, as such there are none.Additionally:
PdfGenerator.ParseStyleSheet(PdfSharp) only wrapped its result inTask.FromResult, it's synchronous now, likeParseStyleSheetof the other adaptersHtmlRenderoverloads that draw onto aGraphics,DrawingContextorCanvasDrawingSessionsay in their remarks, that they shouldn't be called from a paint handler, and point toHtmlContainer.SetHtmlAsyncplusPerformLayoutandPerformPaintinstead. Once something loads over the network, the await completes after the paint handler returned.The line "the names stay the same" in #259 needs an update once this is merged.
How to test this PR?
CI should succeed.