FluentAvalonia icon indicating copy to clipboard operation
FluentAvalonia copied to clipboard

Wrong Window's Background in Native AOT

Open Kengxxiao opened this issue 2 years ago • 1 comments

Describe the bug When a project is compiled by Native AOT, the background of window will be wrong.

Screenshots image

It only produces this issue after compiling by Native AOT, it's normal in other environments. image

Desktop/Platform (please complete the following information):

  • OS: Windows 11 Pro 21H2
  • FluentAvalonia Version 1.4.1.0
  • Avalonia Version 0.10.15.0

Additional context My .csproj (modified from original one)

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net7.0</TargetFramework>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    </PropertyGroup>
    <PropertyGroup>
        <TrimMode>link</TrimMode>
        <PublishTrimmed>true</PublishTrimmed>
        <StripSymbols>true</StripSymbols>
        <PublishAot>true</PublishAot>
    </PropertyGroup>
    <ItemGroup>
        <AvaloniaResource Include="Assets\**" />
        <AvaloniaResource Include="Pages\SampleCode\**" />
        <AvaloniaXaml Update="**\*.axaml">
            <SubType>Designer</SubType>
        </AvaloniaXaml>
    </ItemGroup>
    <ItemGroup>
        <PackageReference Include="Avalonia" Version="0.10.15" />
        <PackageReference Include="Avalonia.AvaloniaEdit" Version="0.10.12.1" />
        <PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
        <PackageReference Include="Avalonia.Diagnostics" Version="0.10.15" />
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\FluentAvalonia\FluentAvalonia.csproj" />
        <RdXmlFile Include="rd.xml" />
    </ItemGroup>
</Project>

My rd.xml

<Directives>
	<Application>
	<Assembly Name="Avalonia.Animation">
		<Type Name="Avalonia.Animation.Easings.QuarticEaseInOut" Dynamic="Required All" />
		<Type Name="Avalonia.Animation.Easings.QuadraticEaseIn" Dynamic="Required All" />
		<Type Name="Avalonia.Animation.Easings.QuadraticEaseOut" Dynamic="Required All" />
		<Type Name="Avalonia.Animation.Easings.CubicEaseOut" Dynamic="Required All" />
		<Type Name="Avalonia.Animation.Easings.LinearEasing" Dynamic="Required All" />
	</Assembly>
	<Assembly Name="Avalonia.Visuals" Dynamic="Required All">
		<Type Name="Avalonia.Media.SolidColorBrush" Dynamic="Required All" />
	</Assembly>

	<Assembly Name="FluentAvalonia" Dynamic="Required All"/>

	<Assembly Name="FluentAvaloniaSamples" Dynamic="Required All"/>
	<Assembly Name="AvaloniaEdit" Dynamic="Required All"/>

	</Application>
</Directives>

Kengxxiao avatar Aug 21 '22 19:08 Kengxxiao

I believe that's the Mica effect failing which is out of my control - the second screenshot (which I believe is the correct one) looks right, but I can see the white background of the window in the titlebar area of the first screenshot which is how I know. There have been other issues with Mica (https://github.com/AvaloniaUI/Avalonia/issues/6465) You can try adding an app.manifest file I think it is and see if that helps (see that linked issue in the Avalonia repo).

amwx avatar Aug 23 '22 02:08 amwx

Closing as this issue does not appear to be directly related to FluentAvalonia

amwx avatar Oct 09 '22 01:10 amwx