-
Notifications
You must be signed in to change notification settings - Fork 23
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
The scheduling policy of OneTimeSchedulingPolicy is not registered to an orchestrator. #192
Comments
Hi @mispencer , Thanks for the report. It is possible for services not to be registered correctly with a custom DI container. Without knowing specifics, it is difficult for us to understand what exactly the cause is. Is it possible for you to provide us with a mini-project that reproduces the issue? BTW, which version of the package are you using? |
I created a example project that shows this error on This is using version 2.5.1 of Microsoft.ApplicationInsights.Profiler.AspNetCore. |
Hi @mispencer, thanks for providing the example code. It is a bug. Issue: wrong lifetime for OneTimeSchedulingPolicy: serviceCollection.AddTransient<SchedulingPolicy, OneTimeSchedulingPolicy>(); // It is registered transient
// Compare to other policies all as singleton:
serviceCollection.AddSingleton<SchedulingPolicy, RandomSchedulingPolicy>();
serviceCollection.AddSingleton<SchedulingPolicy, OnDemandSchedulingPolicy>(); Direct cause: That behavior is different than when it is used with Having a mismatched lifetime for services is not a good practice. I'll prepare a PR to fix the bug and I'll post updates when the fix is released. Unfortunately, until then, there's no easy workaround - unless there's a way to manipulate the lifetime of OneTimeScheudlingPolicy to singleton somehow using |
Please try the newly released 2.5.2-beta1 package: |
This issue doesn't occur after upgrading to that version. |
I get the following error on startup:
I assume this is due to using a custom CI container. Given that, how do I register it with an orchestrator?
This error doesn't appear to block other profiling types from running successfully.
The text was updated successfully, but these errors were encountered: