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

[AOT compatible] Clean up some AOT build issue in FilePreviewCommon and MarkdownPreviewHandler #36207

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

Conversation

moooyo
Copy link
Contributor

@moooyo moooyo commented Dec 4, 2024

Summary of the Pull Request

  • Fix json serializer AOT issue.
  • Especially, use AppContext.BaseDirectory to replace assembly.Location.

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  1. Manual test paseed in my local env.
  2. I will use pipline artifact to do some test after pipline complete and paste the test results here.

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@moooyo
Copy link
Contributor Author

moooyo commented Dec 4, 2024

/azp run

@moooyo moooyo requested a review from snickler December 4, 2024 08:41
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@moooyo moooyo requested a review from crutkas December 4, 2024 08:42
@moooyo
Copy link
Contributor Author

moooyo commented Dec 4, 2024

I encountered some build issue when I was trying to build installer locally. That's the reason why I need to wait for pipeline complete...
I followed the doc and installed the required package. But sesms that there's no icon.ico and PowerToysSetup-0.0.1-x64.msi exist in the Release folder.
Dose anyone know how to solve it? I've checked that the release folder doesn't have these files.

image

@jaimecbernardo
Copy link
Collaborator

Hi @moooyo , I usually build the installer to give it a test through these incantations in the "Developer Command Prompt for VS 2022`:

MSBuild -t:restore -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\PowerToys.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\BugReportTool\BugReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\BugReportTool\BugReportTool.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\WebcamReportTool\WebcamReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\WebcamReportTool\WebcamReportTool.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\StylesReportTool\StylesReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\StylesReportTool\StylesReportTool.sln /p:Configuration=Release /p:Platform="x64"
git clean -xfd  -e *exe -- .\installer\
MSBuild -t:restore .\installer\PowerToysSetup.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\installer\PowerToysSetup.sln /t:PowerToysInstaller /p:Configuration=Release /p:Platform="x64"
MSBuild -m .\installer\PowerToysSetup.sln /t:PowerToysBootstrapper /p:Configuration=Release /p:Platform="x64"

Hope this helps.

@moooyo
Copy link
Contributor Author

moooyo commented Dec 5, 2024

Hi @moooyo , I usually build the installer to give it a test through these incantations in the "Developer Command Prompt for VS 2022`:

MSBuild -t:restore -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\PowerToys.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\BugReportTool\BugReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\BugReportTool\BugReportTool.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\WebcamReportTool\WebcamReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\WebcamReportTool\WebcamReportTool.sln /p:Configuration=Release /p:Platform="x64"
MSBuild -t:restore .\tools\StylesReportTool\StylesReportTool.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\tools\StylesReportTool\StylesReportTool.sln /p:Configuration=Release /p:Platform="x64"
git clean -xfd  -e *exe -- .\installer\
MSBuild -t:restore .\installer\PowerToysSetup.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -m .\installer\PowerToysSetup.sln /t:PowerToysInstaller /p:Configuration=Release /p:Platform="x64"
MSBuild -m .\installer\PowerToysSetup.sln /t:PowerToysBootstrapper /p:Configuration=Release /p:Platform="x64"

Hope this helps.

Thanks!!! It works.

@moooyo
Copy link
Contributor Author

moooyo commented Dec 9, 2024

image

I've added a simple test here.

@moooyo
Copy link
Contributor Author

moooyo commented Dec 9, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@moooyo moooyo marked this pull request as ready for review December 9, 2024 03:14
@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Dec 10, 2024
snickler
snickler previously approved these changes Dec 11, 2024
Copy link
Collaborator

@snickler snickler left a comment

Choose a reason for hiding this comment

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

LGTM

@moooyo
Copy link
Contributor Author

moooyo commented Dec 11, 2024

Accept all suggestions. Thanks @snickler !

@moooyo
Copy link
Contributor Author

moooyo commented Dec 11, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jaimecbernardo jaimecbernardo added the Don't merge - Hold for release Hold off on merging this PR, even if it's approved. label Dec 11, 2024
@jaimecbernardo
Copy link
Collaborator

Hi, we've added the "Don't Merge" tag to the PR, since we're trying to keep the repo stable for the release and possible hotfix if necessary. Please don't merge the PR while the tag is still in here. This allows people to review the PR and approve with less fear that it'll get merged 😄

@crutkas crutkas added Good to merge after release and removed Needs-Review This Pull Request awaits the review of a maintainer. labels Dec 14, 2024
Copy link

@yeelam-gordon yeelam-gordon left a comment

Choose a reason for hiding this comment

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

You may make decision to change it now, or in another PR.


[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(JsonDocument))]
internal sealed partial class FilePreviewJsonSerializerContext : JsonSerializerContext

Choose a reason for hiding this comment

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

I remember I see this file twice on different location.
Looks like we need somewhere more centralized but not per project.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yeelam-gordon each class implementing the JsonSerializerContext class has to be in a spot where each of the class types are available to it. There are many types that are in the Settings project, but some types that are only in the individual projects. This one though, would actually be a good one to be moved to a more centralized location.

@jaimecbernardo jaimecbernardo removed the Don't merge - Hold for release Hold off on merging this PR, even if it's approved. label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants