Skip to content

[AOT] Update logger to support NativeAOT #40154

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

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

Conversation

lei9444
Copy link
Contributor

@lei9444 lei9444 commented Jun 20, 2025

Summary of the Pull Request

Root cause:

FileVersionInfo.GetVersionInfo(Assembly.Location) is not compatible with NativeAOT

Fix:

Replaced the usage of FileVersionInfo with static reflection GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version. This uses static reflection to read version metadata directly from the assembly, which is fully supported in NativeAOT. It does not require file system access and is trimming/AOT-safe.

PR Checklist

  • Closes: #40151
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copy link
Contributor

@moooyo moooyo 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

moooyo commented Jun 20, 2025

Anyone have any concern?

@lei9444
Copy link
Contributor Author

lei9444 commented Jun 20, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lei9444
Copy link
Contributor Author

lei9444 commented Jun 20, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Successfully merging this pull request may close these issues.

2 participants