-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/6.0] Starting metrics before runtime start leads to a crash #81307
[release/6.0] Starting metrics before runtime start leads to a crash #81307
Conversation
…ine (dotnet#76965) * Initial fix for null reference exception * Took away lazy and put back private constructor * Added parent property and made handler thread safe
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsWhen you start a metrics session before the runtime is started, we will get a NullReferenceException in MetricsEventSource. This prevents metrics from being enabled before the process is started. The dotnet diagnostic tooling supports starting a session before the runtime is launched. Customer ImpactPartner teams cannot ship diagnostic tooling on 6.0 without this change. TestingManually verified that the fix works RiskLow.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved. we will take for consideration in 6.0.x
@dramos020 this is an OOB package. Can you please follow these instructions to ensure we build it properly? https://github.com/dotnet/runtime/blob/release/6.0/docs/project/library-servicing.md |
@dramos020 I see this change and the 7.0 one were manually created. Was this merged to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOB changes look good. Thanks for adding them, @dramos020.
@carlossanlop I made the changes to the servicing version and set GeneratePackageOnBuild. Also, these changes were merged to main earlier with this pr #76965 |
Thanks for sharing that info, @dramos020. We ask backport submitters to mention the Not sure if you know this, but in case you don't, it might be helpful - If you type this text as a comment in your main PR:
The github-actions bot will create the 6.0 backport PR for you with all the info filled out in the description. This feature works with all servicing and preview branches. Example of a main PR: #81070 (comment) |
@dramos020 can you please investigate the CI failures in ~System.Diagnostics.Metrics.Tests.MetricsTests`? They might be related to this PR. |
Yup, looking into it right now |
The issue is that the assembly load fails because the ref is still 6.0.0.0 but the src assembly is 6.0.0.1. @carlossanlop @ViktorHofer, do we rev ref assemblies, or is the fix here to use |
Yes, and that got fixed in main and release/7.0 with #78703 and #78730. There's not an easy way to backport the change. We worked around these issues in the past by checking in binding redirects into the .NET Framework test project. Please try that. Here's an example: #78250 |
@dramos020 can you please follow up on Viktor's suggestion? |
I tried Viktor's suggestion, but the tests are still failing. |
Juan's suggestion of adding |
Binding redirects definitely should have worked, maybe you conditioned it on the wrong TargetFramework? Setting |
CI is green. Ready to merge. |
When you start a metrics session before the runtime is started, we will get a NullReferenceException in MetricsEventSource. This prevents metrics from being enabled before the process is started. The dotnet diagnostic tooling supports starting a session before the runtime is launched.
Customer Impact
Partner teams cannot ship diagnostic tooling on 6.0 without this change.
Testing
Manually verified that the fix works
Risk
Low.