Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Confilct #1681

Open
Gaoyifei1011 opened this issue Jul 24, 2024 · 8 comments
Open

API Confilct #1681

Gaoyifei1011 opened this issue Jul 24, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@Gaoyifei1011
Copy link
Contributor

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

ccfd504559f510d2c5727a11b2e43355

Expected behavior

Keep one set of apis

Version Info

CsWinRT 2.1.0-prerelease.240722.1

Additional context

None

@Gaoyifei1011 Gaoyifei1011 added the bug Something isn't working label Jul 24, 2024
@manodasanW
Copy link
Member

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.

@dongle-the-gadget
Copy link
Contributor

Should we make an analyzer to point people to the correct class?

@Sergio0694
Copy link
Member

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 🙂

@Marv51
Copy link

Marv51 commented Aug 2, 2024

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

@Sergio0694
Copy link
Member

@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 🙂

@Gaoyifei1011
Copy link
Contributor Author

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
image
image

@dongle-the-gadget
Copy link
Contributor

Are you using Windows.UI.Colors? That loads Windows.UI.Xaml.dll.

@Gaoyifei1011
Copy link
Contributor Author

Are you using Windows.UI.Colors? That loads Windows.UI.Xaml.dll.

Yes, I temporarily switched to Windows.ui.colors due to a conflict with the previous Microsoft.ui.colors api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants