-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
In a WinUI3 project I get errors telling me that I need to set DisableRuntimeMarshalling but I have done so. And if I add [assembly:DisableRuntimeMarshalling] then I get a "duplicate attribute defined" later during compile.
Reproduction Steps
I pushed a repro up here: https://github.com/jevansaks/WinUI3ComGeneratorsRepro
But the repro is:
- File => New Project "WinUI Blank App (Packaged)"
- Add this to the csproj:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PublishAot>true</PublishAot>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>- Add this to app.xaml.cs:
[Guid("00000000-0000-0000-0000-000000000003"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GeneratedComInterface]
public partial interface IRepro
{
void Test(global::System.Drawing.Point pt);
}Expected behavior
Compiles.
Actual behavior
Gives a confusing error:
App.xaml.cs(33,48,33,50): error SYSLIB1051: Runtime marshalling must be disabled in this project by applying the 'System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute' to the assembly to enable marshalling this type. The generated source will not handle marshalling of parameter 'pt'. (https://learn.microsoft.com/dotnet/fundamentals/syslib-diagnostics/syslib1051)
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
This seems to be because XamlPreCompile doesn't get all the things passed to it that CoreCompile does. Again. Why does this target exist? :)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status