CsWinRT
CsWinRT copied to clipboard
API Confilct
Describe the bug
API Confilct
To Reproduce
When I upgraded to CsWinRT CsWinRT 2.1.0-prerelease.240722.1, I compiled the WinUI 3 project and found that both Microsoft.UI.Colors and Windows.UI.Colors were referenced
Expected behavior
Keep one set of apis
Version Info
CsWinRT 2.1.0-prerelease.240722.1
Additional context
None
This is expected right now. It will be resolved by the time this version is ingested in the .NET SDK as it requires some changes we are making there. For now, you can either use a fully qualified type name or a type alias to workaround it.
Should we make an analyzer to point people to the correct class?
I don't think it's worth it, given that:
- All the Windows.UI.* types will go away as soon as we update the SDK
- Once we have the updated SDK, if anyone opts-in, WinAppSDK will show a dedicated warning about using "mixed mode", and you'll need to set a separate property manually to override that behavior and make the warning go away.
So in practice once those two updates are in place, the only people hitting this will be expected to know what they're doing 🙂
Will this also resolve my issue with Windows.UI.Text.TextDecorations or should I file a separate issue?
I get this error:
error CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
and 'Microsoft.Windows.UI.Xaml, Version=10.0.22621.35, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
So far, I have not been able to resolve this one by fully qualifying the name.
I am using it for this API: https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.documents.textelement.textdecorations
@marv51 that's a known issue with some types, but it's only temporary because of a combination of things:
- You are using an older version of WinAppSDK (if you use 1.6-experimental2, you shouldn't hit this)
- You are using a preview version of the SDK projections (the next stable release will not have this issue)
So for a temporary workaround, I'd recommend either upgrading WinAppSDK to preview, or downgrading the SDK to latest stable. Alternatively, if you're not using trimming in your project, you should also be able to work around this by temporarily setting CsWinRTRcwFactoryFallbackGeneratorForceOptOut to true in your .csproj file 🙂
This is expected right now. It will be resolved by the time this version is ingested in the .NET SDK as it requires some changes we are making there. For now, you can either use a fully qualified type name or a type alias to workaround it.
I suddenly and unexpectedly found that the WinUI 3 desktop program accidentally loaded Windows.UI.Xaml.dll during debugging
我突然意外的发现,WinUI 3 桌面程序在调试过程中,意外加载了 Windows.UI.Xaml.dll
Are you using Windows.UI.Colors? That loads Windows.UI.Xaml.dll.
Are you using
Windows.UI.Colors? That loadsWindows.UI.Xaml.dll.
Yes, I temporarily switched to Windows.ui.colors due to a conflict with the previous Microsoft.ui.colors api