Problem
When using the .NET agent, your .NET 8.x application may hang during startup due to a known runtime issue.
Solution
This issue is caused by a bug in the .NET runtime. While the bug is fixed in .NET 9, a backported fix is available for .NET 8. However, the fix introduces a breaking change and is not enabled by default.
To enable the fix, apply the following AppConfig to your application:
"configProperties": { "System.Diagnostics.Tracing.CounterCallbackOnTimerThread": true}
You can also apply this setting by modifying your MSBuild project file or using an environment variable. For more details, refer to Microsoft's documentation on .NET runtime configuration settings.