Comments (5)
This issue doesn't occur after upgrading to that version.
from applicationinsights-profiler-aspnetcore.
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?
from applicationinsights-profiler-aspnetcore.
I created a example project that shows this error on dotnet run
.
This is using version 2.5.1 of Microsoft.ApplicationInsights.Profiler.AspNetCore.
from 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:
Policies are injected, and then enumerated twice in the orchestrator. The first time to register it with the orchestrator; the 2nd time to activate the policy.
Upon the 2nd enumerating, OneTimeScheudlingPolicy
gets a new instance - thus not registered - and the error message - and it can't be activated.
That behavior is different than when it is used with Microsoft.Extensions.DependencyInjection
, where the policies are all captured by the orchestrator, and thus has an effective lifetime of a singleton.
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 NinjectServiceProviderFactory
, or change the behavior to let the service being captured.
from applicationinsights-profiler-aspnetcore.
Please try the newly released 2.5.2-beta1 package:
https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.5.2-beta1
from applicationinsights-profiler-aspnetcore.
Related Issues (20)
- visual studio and docker-compose not working. HOT 2
- Repeated "Instrumentation Key is empty." error messages in logs since v2.5.0 HOT 8
- Worker service sometimes hangs at profiler startup HOT 4
- User report: Memory usage is almost always > 90% on Linux, investigate why HOT 9
- This repo is missing important files
- Could not get the stamp id. Aborting the upload process HOT 15
- [Feature] Handle throttling of 429 better
- Trace file is left when the process crashed before stopping the profiling HOT 5
- The EventPipe Profiler doesn't work with Azure Function (App Service Plan)
- Remove the support of SkipUpload
- EventPipe session was not disposed upon stopping exception
- How-To Use it Properly with OpenTelemetry NuGet? HOT 1
- Please Update Examples To Use APPLICATIONINSIGHTS_CONNECTION_STRING Instead of APPINSIGHTS_INSTRUMENTATIONKEY
- Reduce dependency logging for certain API calls HOT 1
- Profiler throws error in trace: AI: Process was called on the TelemetrySink after it was disposed HOT 2
- Role name in application insights profile list HOT 6
- Bump up the target framework for the uploader to .NET 6
- Issue with starting and stopping a process with the profiler running in same process HOT 2
- When you publish an update for Microsoft.ApplicationInsights.Profiler.AspNetCore, don't mark the previous version as deprecated immediately HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applicationinsights-profiler-aspnetcore.