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

Incompatiblity with WinUI Preview 4 (using daily) #124

Closed
dotMorten opened this issue Feb 18, 2021 · 7 comments · Fixed by #128
Closed

Incompatiblity with WinUI Preview 4 (using daily) #124

dotMorten opened this issue Feb 18, 2021 · 7 comments · Fixed by #128
Assignees

Comments

@dotMorten
Copy link

dotMorten commented Feb 18, 2021

Looks like I'm still hitting some incompatibilities with WinUI and the latest daily (v0.1.362-beta). From my understanding the issues in #59 should have been addressed already.

To repro, create the following project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
    <RootNamespace>CsWin32Repro</RootNamespace>
    <RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-public/vside/_packaging/winsdk/nuget/v3/index.json;$(RestoreAdditionalProjectSources)</RestoreAdditionalProjectSources>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Windows.CsWin32" Version="0.1.362-beta">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview4.210210.4" />
  </ItemGroup>
</Project>

Next add Shell_NotifyIcon to the NativeMethods.txt and compile.
Observe these two build errors:

1>E:\sources.tmp\CsWin32Repro\CsWin32Repro\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.SourceGenerator\NOTIFYICONDATAW.g.cs(146,25,146,29): error CS0234: The type or namespace name 'Guid' does not exist in the namespace 'Microsoft.System' (are you missing an assembly reference?)
1>E:\sources.tmp\CsWin32Repro\CsWin32Repro\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.SourceGenerator\PInvoke.Shell32.g.cs(49,98,49,104): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('NOTIFYICONDATAW')
1>Done building project "CsWin32Repro.csproj" -- FAILED.

Remove the WinUI package, and things builds fine.

The first one seems to be able to be addressed with changing internal System.Guid guidItem; to internal global::System.Guid guidItem; which in turn takes care of the second error.

I'm guessing anything that is using a namespace in the type name should be prefixed with global::

@AArnott AArnott self-assigned this Feb 18, 2021
@AArnott
Copy link
Member

AArnott commented Feb 18, 2021

It looks from the errors I'm seeing from your repro that I need to install some VC SDKs... trying now...

@AArnott
Copy link
Member

AArnott commented Feb 18, 2021

image

AArnott added a commit that referenced this issue Feb 18, 2021
@AArnott
Copy link
Member

AArnott commented Feb 18, 2021

I never could get the SDKs to work. But I was able to repro the problem trivially in a test so we can make sure this never regresses.

@dotMorten
Copy link
Author

Thanks @AArnott . Fix looks great

AArnott added a commit that referenced this issue Feb 18, 2021
@dotMorten
Copy link
Author

Just confirming that 0.1.370-beta works great with WinUI 3. Thank you!

@dotMorten
Copy link
Author

I never could get the SDKs to work.

@AArnott FYI if you're hitting this:
image

You're missing this:
image

@AArnott
Copy link
Member

AArnott commented Feb 22, 2021

I never hit that, because your repro used earlier build targets. But I installed all the ones referenced in your repro and it still didn't work.
No worries though. I don't need to at this point.

AArnott added a commit that referenced this issue May 6, 2022
Update to the .NET 6 SDK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants