-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
dotnet-counters: Missing System.Runtime-Counters when publishing a trimmed app #79648
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @tommcdon Issue DetailsDescriptionWhen a net6-application is published 'trimmed', the System.Runtime-Counters collected with dotnet-counters are not available. Reproduction Steps
The behaviour is described in the (closed) issue #44910 as well. Expected behaviorSystem.Runtime counters give essential first-level informations when you search for example memory-leaks in a running docker-container. I would expect to get these important informations independent of the publish-mode. Actual behaviorA docker-container which is published trimmed cannot be profiled with dotnet-counters (concerning the System.Runtime-Counters) Regression?No response Known WorkaroundsThe workaround described in #44910 works: if you manually initialize the event-source, the counters are available in the trimmed container-image as well:
I run the above snippet in the startup of the app, depending of an env-var, so you can turn on/off the profiling in a container ConfigurationNo response Other informationNo response
|
@clane2812 Thanks for reporting this issue! Does this issue reproduce on .net 7? |
@tommcdon - yes, the issue is the same with .net7. Tried debug/release publish as well, but this makes no difference: |
@LakshanF, would we be able to get EventSource whitelisted so it is not trimmed? I am not sure what our policy is around that. It would be great if we could support diagnostic scenarios like counters out of the box instead of having users debug/fix it on their own. |
@davmason what is the thing that is getting trimmed here and shouldn't? I see there's descriptors that say not to trim the runtime/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.EventSource.xml Line 4 in da2c147
What else is needed? |
Sorry for the delay here, we have had an influx of issues. I have asked @dramos020 to take a look |
After some investigation, I believe that it is not Initialize() that is getting trimmed, but instead ProcessStartupHooks(), which calls Initialize(), that is getting trimmed. It seems that the trimming is happening because StartupHookSupport is disabled by default. Not sure what the solution/next steps to this would be. |
This was fixed for .NET 8 by #80391 |
Description
When a net6-application is published 'trimmed', the System.Runtime-Counters collected with dotnet-counters are not available.
Reproduction Steps
Create and run a simple console-application
dotnet-counters monitor --process-id --refresh-interval 3 --counters System.Runtime
All counters are collected
Publish the app with 'trimmed' mode and run it
dotnet-counters monitor --process-id --refresh-interval 3 --counters System.Runtime
No counters are collected
The behaviour is described in the (closed) issue #44910 as well.
Expected behavior
System.Runtime counters give essential first-level informations when you search for example memory-leaks in a running docker-container. I would expect to get these important informations independent of the publish-mode.
Actual behavior
A docker-container which is published trimmed cannot be profiled with dotnet-counters (concerning the System.Runtime-Counters)
Regression?
No response
Known Workarounds
The workaround described in #44910 works: if you manually initialize the event-source, the counters are available in the trimmed container-image as well:
I run the above snippet in the startup of the app, depending of an env-var, so you can turn on/off the profiling in a container
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: