CsWinRT
CsWinRT copied to clipboard
Authoring generator throws Win32Exception for methods with WindowId parameters
Describe the bug
Just noticed the following failure when using WindowId
as a parameter for a method:
"CSC : warning CS8785: Generator 'SourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'Win32Exception' with message 'Incorrect function'."
To Reproduce
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<Platforms>x64;ARM64</Platforms>
<CsWinRTComponent>true</CsWinRTComponent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.4" />
</ItemGroup>
</Project>
using Windows.UI;
namespace MinimalWinRTComponentTest;
public sealed partial class MyClass
{
public void Test(WindowId id)
{
}
}
Expected behavior
Should work fine..?
Version Info
- Latest AOT previews for CsWinRT and Windows SDK (as of January 6th 2024)
- Also reproes on normmal 2.0.4