Add Svg.Controls.Skia.Maui control support#508
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e78237e04a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8525dc4cc5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5a0a5090b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8954a6e09c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
wieslawsoltes
left a comment
There was a problem hiding this comment.
Submitted review-thread reply for commit 8954a6e.
wieslawsoltes
left a comment
There was a problem hiding this comment.
Submitted review-thread reply for commit 8954a6e.
wieslawsoltes
left a comment
There was a problem hiding this comment.
Submitted review-thread reply for commit 8954a6e.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 934ba9ca93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
wieslawsoltes
left a comment
There was a problem hiding this comment.
Submitted review-thread reply for commit 861f2f8.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 861f2f8786
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5ca004a31
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70b1c416e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| catch (OperationCanceledException) | ||
| { | ||
| DisposeResultIfOwned(result); | ||
| } |
There was a problem hiding this comment.
Treat timeout cancellations as source-load failures
ReloadSourceAsync unconditionally swallows OperationCanceledException, but remote loads can throw TaskCanceledException on HttpClient timeout even when cancellationToken was never canceled. In that case this path skips the normal failure handling and never clears the completed load token, leaving _pendingLoadCts stale and causing later lifecycle/cache logic to behave as if a load is still in flight. Please branch this catch on cancellationToken.IsCancellationRequested and route non-token cancellations through the error path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11ee3384c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (clone.HasPathSource) | ||
| { | ||
| await clone.ReLoadAsync(parameters, cancellationToken).ConfigureAwait(false); | ||
| } |
There was a problem hiding this comment.
Avoid reloading already-loaded external path sources
LoadExternalSourceAsync unconditionally calls ReLoadAsync for any clone with HasPathSource, even when no per-control parameters are being applied. For callers that pass an already-loaded SvgSource (with a valid in-memory picture), this forces unnecessary reparsing and can regress correctness: if the underlying file/path is temporarily unavailable, the reload path returns an empty result and the control clears instead of using the already-loaded clone. Gate this reload so path-backed clones are reused when no parameterized restyle is needed.
Useful? React with 👍 / 👎.
| if (System.IO.Path.IsPathRooted(path)) | ||
| { | ||
| var fullPath = System.IO.Path.GetFullPath(path); | ||
| return new Uri(fullPath); | ||
| } |
There was a problem hiding this comment.
Preserve leading-slash MAUI asset paths as package URIs
This rooted-path branch converts inputs like /Assets/icon.svg into file URIs (Path.GetFullPath + new Uri(fullPath)), so later loading goes through file-system checks instead of maui-app package asset resolution. In MAUI apps, leading-slash logical asset paths are commonly expected to resolve from app package assets, so this behavior makes those paths fail unless a real absolute file exists at that OS root path. Handle app-asset rooted paths before generic rooted-file normalization.
Useful? React with 👍 / 👎.
Add Svg.Controls.Skia.Maui Control Support
Summary
This PR adds a dedicated
Svg.Controls.Skia.Mauipackage for .NET MAUI applications that need a reusable Skia-backed SVG view. It addresses the control-support gap discussed in GitHub Discussion #83 by bringing the external-asset/source-string control model used bySvg.Controls.Skia.Unoto MAUI, while keepingSvgML.Mauipositioned for inline XAML-authored SVG trees andforeignObjectscenarios.Background
Discussion #83 asked whether
Svg.Skiacan be used from a .NET MAUI application. The answer is now split into two supported MAUI paths:Svg.Controls.Skia.Mauifor external.svgfiles, source strings, reusableSvgSourceresources, hit testing, zoom/pan, render flags, and animation playback on top ofSKCanvasView.SvgML.Mauifor authoring the SVG element tree directly in MAUI XAML and hosting native MAUI controls inside SVGforeignObject.Implementation
src/Svg.Controls.Skia.Maui.Maui.Svg.Skia.Svg, aSkiaSharp.Views.Maui.Controls.SKCanvasView-based SVG control.Path,Source,SvgSource,Stretch,StretchDirection,EnableCache,Wireframe,DisableFilters,Zoom,PanX,PanY,Css, andCurrentCss.Svg.Skiaanimation host model.FileSystem.OpenAppPackageFileAsync(...), plus absolute file andhttp/httpssource support.SvgSourceloading, cloning, reloading, stream/document helpers, and cache-key handling.https://github.com/svgskia/maui.SvgML.MauiandSvg.Controls.Skia.Maui.Svg.Controls.Skia.Mauiout of generated Lunet API extraction because the Docs workflow runs on Ubuntu without MAUI workloads; the package remains covered by authored docs and dedicated MAUI build/pack jobs.Documentation
site/articles/packages/svg-controls-skia-maui.md..NET MAUIsection to explain when to useSvg.Controls.Skia.MauiversusSvgML.Maui.SvgML.Mauidocs.Validation
dotnet format Svg.Skia.slnx --no-restore.dotnet format src/Svg.Controls.Skia.Maui/Svg.Controls.Skia.Maui.csproj --no-restore.dotnet build src/Svg.Controls.Skia.Maui/Svg.Controls.Skia.Maui.csproj -c Release.net10.0-android,net10.0-ios, andnet10.0-maccatalyst.dotnet build src/Svg.Controls.Skia.Maui/Svg.Controls.Skia.Maui.csproj -c Release --no-restore.net10.0-android,net10.0-ios, andnet10.0-maccatalystwith zero warnings after the review fixes.dotnet build Svg.Skia.slnx -c Release.dotnet test Svg.Skia.slnx -c Release --no-restore --no-build.Svg.Skia.UnitTestswith 1635 passed and 593 skipped..github/workflows/build.ymland.github/workflows/release.yml../build-docs.sh.Svg.Controls.Skia.Mauifrom generated API extraction, avoiding the previous UbuntuNETSDK1147MAUI workload failure.git diff --check.Notes
binandobjoutput under the new MAUI package was removed before staging.plan/pr-summary-maui-compatibility-discussion-83.mdis intentionally left uncommitted and used as the pull request description.