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

AppMetrics usage causes Native AoT build issues #767

Open
huntharo opened this issue Dec 16, 2023 · 0 comments
Open

AppMetrics usage causes Native AoT build issues #767

huntharo opened this issue Dec 16, 2023 · 0 comments

Comments

@huntharo
Copy link

Overview

I was able to use AppMetrics in a portion of a project that does not use Native AoT and I liked it!

But then I added it to the part of the project that uses Native AoT and it causes the app to not work due to issues with reflection and trimming. The issue starts with a logging class but here may be other additional issues.

There may be a solution that consumers of the library can use (from the docs below) to allow the library to function with Native AoT, but I am not sure. I think there may be annotations or refactoring required in the library itself.

I figured I would log this issue as I had looked for a report of it and found none.

If anyone wants to collaborate on debugging this I'm up for doing a code pairing over Google Meets or similar.
 

Self-Contained Reproducible Example

https://github.com/huntharo/app.metrics-native-aot

The example has two console apps:

  1. One uses AppMetrics - This gives warnings about trimming during builds and fails on startup
  2. The other does not use AppMetrics - This gives no warnings and runs fine

Docs on Issues with Trimming

https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming?pivots=dotnet-8-0#resolve-trim-warnings

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

No branches or pull requests

1 participant