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

Code Quality: Upgrade dependencies #16741

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

hez2010
Copy link
Member

@hez2010 hez2010 commented Jan 27, 2025

Upgrade to .NET 9
Upgrade to WASDK 1.6
Upgrade to CommunityToolkit.WinUI 8.2
Upgrade to CsWinRT 2.2
Migrate to slnx (while still keeping sln for CI now)
Use centralized nuget package version management
Use new Microsoft.UI.Content metadata

Known issues:

  • TotalLaunchCount will be reset as we implement a different approach for counting this
  • slnx won't work in CI until .NET SDK 9.0.200 is out
  • Scroll via middle click
  • Mouse cursors

Resolved / Related Issues

Supersedes #16156
Supersedes #16557
Closes #14826
Closes #16705

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Opened Files ...
  2. ...

.gitignore Outdated Show resolved Hide resolved
@yaira2 yaira2 changed the title Upgrade dependencies Code Quality: Upgrade dependencies Jan 27, 2025
@hez2010
Copy link
Member Author

hez2010 commented Jan 27, 2025

I temporarily brought back the sln for CI.

@hez2010
Copy link
Member Author

hez2010 commented Jan 27, 2025

CI is passing

@Lamparter
Copy link
Contributor

This PR also supersedes #16557 and closes #14826

@Lamparter
Copy link
Contributor

By the way, the work you put into this is amazing and the fact that it works is jaw-dropping 😮


static App()
{
using var infoKey = Registry.CurrentUser.CreateSubKey(AppInformationKey);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the virtual registry? Also, it would be preferable to create a helper class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's virtual registry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to use our existing settings service?

Copy link
Member Author

@hez2010 hez2010 Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Information.* APIs are no longer available in WCT 8.x. Registry ensures the thread safety IMO, so if multiple Files instances launch simultaneously, there won't be any read-write conflicts.
But yeah it can be anything. I implemented this just because it's convenient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if multiple Files instances launch simultaneously, there won't be any read-write conflicts.

This is good enough reason to use the registry, however, we should put it in a separate helper for code quality.

@files-community-bot
Copy link
Contributor

⛔ No XAML files changed.

Copy link
Contributor

@Lamparter Lamparter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking amazing! ❤️

Comment on lines 2 to 7
<configuration>
<packageSources>
<add key="Project Packages" value="src/Files.App/Assets/Libraries/" />
<add key="Lab-Windows" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<configuration>
<packageSources>
<add key="Project Packages" value="src/Files.App/Assets/Libraries/" />
<add key="Lab-Windows" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>
<configuration>
<packageSources>
<clear />
<add key="NuGet Gallery" value="https://api.nuget.org/v3/index.json" />
<add key="Project Packages" value="src/Files.App/Assets/Libraries/" />
<add key="Toolkit Labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>

This could potentially fix issues on some computers where the user has a custom NuGet setup.

Also rename to Toolkit Labs to be consistent with what Microsoft calls it

/// The number and the width of items are calculated based on the
/// screen resolution in order to fully leverage the available screen space. The property ItemsHeight define
/// the items fixed height and the property DesiredWidth sets the minimum width for the elements to add a
/// new column.</remarks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// new column.</remarks>
/// new column.
/// </remarks>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and many other files are missing the license header.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yaira2 there's a built in functionality to Visual Studio that automatically appends any header of your choice to each new file.
I can set this up in another PR if you would like.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to retain the .NET Foundation license header

using System.Threading.Tasks;

namespace Files.App.Controls
{ /// <summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ /// <summary>
{
/// <summary>

var gridSplitter = (GridSplitter)d;

gridSplitter._hoverWrapper?.UpdateHoverElement(gridSplitter.CursorBehavior ==
SplitterCursorBehavior.ChangeOnSplitterHover
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SplitterCursorBehavior.ChangeOnSplitterHover
SplitterCursorBehavior.ChangeOnSplitterHover

var gridSplitter = (GridSplitter)d;

gridSplitter._hoverWrapper?.UpdateHoverElement(gridSplitter.CursorBehavior ==
SplitterCursorBehavior.ChangeOnSplitterHover
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SplitterCursorBehavior.ChangeOnSplitterHover
SplitterCursorBehavior.ChangeOnSplitterHover

Comment on lines +1 to +2
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
// Copyright (c) Files Community
// Licensed under the MIT License.

@@ -19,12 +19,14 @@
using WinRT;
using static Vanara.PInvoke.ShlwApi;
using static Vanara.PInvoke.User32;
using System.Runtime.InteropServices.Marshalling;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you created a WindowsTargetFramework MSBuild switch so you don't need to specify $(TargetFrameworkVersion)-windows$(TargetWindowsVersion) in every project file?
e.g.:

<!-- Directory.Build.props -->
<WindowsTargetFramework>$(TargetFrameworkVersion)-windows$(TargetWindowsVersion)</WindowsTargetFramework>

and then in the project file:

<!-- Files.*.csproj, Target: Windows -->
<TargetFramework>$(WindowsTargetFramework)</TargetFramework>

<TargetFrameworkVersion>net9.0</TargetFrameworkVersion>
<TargetWindowsVersion>10.0.22621.0</TargetWindowsVersion>
<MinimalWindowsVersion>10.0.19041.0</MinimalWindowsVersion>
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion>
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion>
<DefineConstants>$(DefineConstants);$(Platform)</DefineConstants>

@0x5bfa
Copy link
Member

0x5bfa commented Feb 2, 2025

I won't request changes for tiny quality and sanitization issues as long as it works (and looks perfect already) in this PR given lots of work have been put and it still WIP.

@Lamparter
Copy link
Contributor

Wait, this PR is WIP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants