Files
PowerToys/src/modules/Hosts/Hosts.FuzzTests/HostsEditor.FuzzTests.csproj

56 lines
2.7 KiB
XML
Raw Normal View History

<Project Sdk="Microsoft.NET.Sdk">
<!-- Look at Directory.Build.props in root for common stuff as well -->
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
<Import Project="..\..\..\Common.Dotnet.FuzzTest.props" />
<PropertyGroup>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
Fix Build Warning on Host (#40027) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Fixed build warnings WMC1510 in `HostsMainPage.xaml` that were preventing proper AOT (Ahead-of-Time) compilation compatibility for XAML data bindings. ### Problem The Hosts module was generating multiple WMC1510 warnings during build: ``` src\modules\Hosts\HostsUILib\HostsMainPage.xaml(614,13): Warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive... ``` These warnings occurred on 6 different binding expressions in the EntryDialog ContentDialog that bound to properties of the `Entry` model class. ### Solution Applied the recommended fix by adding proper type information for the XAML compiler: 1. **Added `x:DataType="models:Entry"`** to the ContentDialog element to specify the binding context type 2. **Added `[Bindable]` attribute** to the Entry model class to ensure WinRT compatibility ### Changes Made - **HostsMainPage.xaml**: Added `x:DataType="models:Entry"` attribute to the EntryDialog ContentDialog - **Entry.cs**: Added `[Bindable]` attribute and `using Microsoft.UI.Xaml.Data;` directive <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments - ✅ Resolves all 6 WMC1510 warnings in the specified lines - ✅ Ensures AOT compilation compatibility - ✅ No functional changes to UI behavior - ✅ Minimal code changes (3 lines total) - ✅ Follows Microsoft's recommended approach for WinRT data binding The fix enables proper trimming and AOT compilation while maintaining all existing functionality. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Try to build and run locally without problem.
2025-06-15 23:13:16 -07:00
<DefineConstants>TESTONLY</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\tests\Hosts.FuzzTests\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Hosts.Tests\Mocks\CustomMockFileSystem.cs" Link="CustomMockFileSystem.cs" />
<Compile Include="..\Hosts.Tests\Mocks\MockFileSystemWatcher.cs" Link="MockFileSystemWatcher.cs" />
<Compile Include="..\Hosts.Tests\Mocks\MockFileSystemWatcherFactory.cs" Link="MockFileSystemWatcherFactory.cs" />
<Compile Include="..\HostsUILib\Consts.cs" Link="Consts.cs" />
<Compile Include="..\HostsUILib\Helpers\ValidationHelper.cs" Link="ValidationHelper.cs" />
<Compile Include="..\HostsUILib\Exceptions\NotRunningElevatedException.cs" Link="NotRunningElevatedException.cs" />
<Compile Include="..\HostsUILib\Exceptions\ReadOnlyHostsException.cs" Link="ReadOnlyHostsException.cs" />
<Compile Include="..\HostsUILib\Helpers\HostsService.cs" Link="HostsService.cs" />
<Compile Include="..\HostsUILib\Helpers\IElevationHelper.cs" Link="IElevationHelper.cs" />
<Compile Include="..\HostsUILib\Helpers\IHostsService.cs" Link="IHostsService.cs" />
<Compile Include="..\HostsUILib\Helpers\ILogger.cs" Link="ILogger.cs" />
<Compile Include="..\HostsUILib\Helpers\LoggerInstance.cs" Link="LoggerInstance.cs" />
<Compile Include="..\HostsUILib\Models\AddressType.cs" Link="AddressType.cs" />
<Compile Include="..\HostsUILib\Models\Entry.cs" Link="Entry.cs" />
<Compile Include="..\HostsUILib\Models\HostsData.cs" Link="HostsData.cs" />
<Compile Include="..\HostsUILib\Settings\HostsAdditionalLinesPosition.cs" Link="HostsAdditionalLinesPosition.cs" />
<Compile Include="..\HostsUILib\Settings\HostsEncoding.cs" Link="HostsEncoding.cs" />
<Compile Include="..\HostsUILib\Settings\IUserSettings.cs" Link="IUserSettings.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Moq" />
<PackageReference Include="MSTest" />
<PackageReference Include="System.IO.Abstractions" />
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" />
</ItemGroup>
<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>
<ItemGroup>
<Content Include="OneFuzzConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>