Skip to content

Comments

Update CsWinRT version to 2.2.0#3433

Open
wangfys wants to merge 1 commit intomono:mainfrom
wangfys:wangfys/update-cswinrt
Open

Update CsWinRT version to 2.2.0#3433
wangfys wants to merge 1 commit intomono:mainfrom
wangfys:wangfys/update-cswinrt

Conversation

@wangfys
Copy link

@wangfys wangfys commented Dec 20, 2025

Description of Change

Version Update to make SkiaSharp.Views.WinUI.Native.Projection trimming-safe

Bugs Fixed

API Changes

None.

Behavioral Changes

None.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@wangfys
Copy link
Author

wangfys commented Dec 20, 2025

@dotnet-policy-service agree

mattleibow
mattleibow previously approved these changes Jan 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CsWinRT dependency in the WinUI native projection project to a newer version intended to resolve trimming-safety warnings when using NativeAOT, addressing issue #3327.

Changes:

  • Bump Microsoft.Windows.CsWinRT package reference from 2.0.4 to 2.2.0 in SkiaSharp.Views.WinUI.Native.Projection.csproj.
  • No code or API changes; only build/dependency configuration is updated.

@mattleibow
Copy link
Contributor

mattleibow commented Jan 28, 2026

Thansk for this PR! I triggered the build internally and I see we are getting an error:

   "D:\a\1\s\native\winui\SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.sln" (Build target) (1:2) ->
   "D:\a\1\s\native\winui\SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.Projection\SkiaSharp.Views.WinUI.Native.Projection.csproj" (default target) (3:6) ->
   (CoreCompile target) -> 
     D:\a\1\s\native\winui\SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.Projection\obj\Release\net6.0-windows10.0.19041.0\Generated Files\CsWinRT\SkiaSharp.Views.WinUI.Native.cs(108,162): error CS0117: 'IBufferMethods' does not contain a definition for 'IID' [D:\a\1\s\native\winui\SkiaSharp.Views.WinUI.Native\SkiaSharp.Views.WinUI.Native.Projection\SkiaSharp.Views.WinUI.Native.Projection.csproj]

@wangfys
Copy link
Author

wangfys commented Jan 29, 2026

Oh, I finally reproduced this build error. It is quite painful to prepare the environment since lots of stuffs are updated. For example, I ran into llvm/llvm-project#95133 when trying to build externals-windows. Luckily, I finally realized that I only need to build externals-winui.

It seems like it is related to code generation. I need some time to check whether I can fix it here or we need to wait for bug fix from CsWinRT.

@wangfys
Copy link
Author

wangfys commented Feb 1, 2026

@mattleibow Hello, I can now build externals-winui successfully. The reason for the build failure is that the Windows metadata bundled with the .NET SDK 8.0.100 is outdated for CsWinRT 2.2.0. So, I added this line:

<CsWinRTWindowsMetadata>10.0.17763.57</CsWinRTWindowsMetadata>

But I'm a little bit concerned about what if users of SkiaSharp use an old version.

By the way, I only made externals-winui build successfully. I struggled a lot but still failed to prepare the environment for building the whole solution.

@wangfys wangfys force-pushed the wangfys/update-cswinrt branch from c40ec6a to ae9374f Compare February 1, 2026 06:28
mattleibow added a commit that referenced this pull request Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG / WinUI] SkiaSharp is not trimming-safe

2 participants