TldrOlli
Question about Dependency Injection:
Out of curiosity what’s the benefit of using the IServiceCollection interface over just the autofac container? I’m using spectre cli which lets me register any DI system so wasn’t sure if it was just for generic host supportThere is no benefit you are looking for, I guess.
IServiceCollection
is a very general interface that handles registrations, nothing more. It depends on the actual container (framework) that is used behind the scenes. If you are, for example, in a Asp.Net project, then you would want to use the IServiceCollection
instance, mainly because all the framework registrations also go there (so it prevents you from having a completely seperate ioc container). You can define the fwk to use for DI at startup.
some of the features like xml configuration for loading in interfaces could be useful to adapt the project for different businesses that might use different log systemsHave a look at IConfiguration here, things like that are possible with the standard container.
I’m also looking into the decorator pattern autofac supports for implementing logging and other features on some interfaces provided by other librariesAoP is certainly something that the M.E.DI container does not support, but you could make it work together with Castles Dynamic Proxy. But at that point.. it makes more sense to use something others built already for you. To be clear: I don't have anything against AutoFac, there are certainly use cases for it. Usually you just don't need it unless you want something quite nieche. I'm a bit an DI enthusiast and I had to use it only once so far, where the standard container was not sufficient. 🙂
74 replies
Question about Dependency Injection:
I've recently added something similar based on
Microsoft.Extensions.DependencyInjection
, I'm guessing you are looking for something roughly like this.
For that, there is no need to use AutoFac, just be aware that the Assembly in question must be loaded, otherwise you will not find any types populated.
While I agree with @TeBeCo, there are use cases for AutoFac, even when you are using the IServiceCollection interface (there is a neat adapter for it). For example AutoFac has support for tenant-specific containers, i.e. resolving different services based on some kind of tenant-identification (see here, but that only as a side note)74 replies
✅ Process API: Memory Leaks in Windows (?)
Welp.. Having it running for3 hours on the dev machine now.. there is no sign of perf. degredation or any memory leak (╯°□°)╯︵ ┻━┻
I guess I'll deploy it as a service here too, to be sure..
Somehow I start feeling like my target (mini-pc/192.168.178.50) is the one causing the trouble.. as in: It's depending where it runs
34 replies
✅ Process API: Memory Leaks in Windows (?)
Mh, opentel doesn't like the metric (same for max).. I took a look here and other places..
My best guess would be that my otelcol-contrib is not up-to-date enough (installed yesterday :/)
Edit: Tried multiple versions, current log is wrong.. one sec
Edit2: Fixed
Config:
34 replies
✅ Process API: Memory Leaks in Windows (?)
I will prepare that now and run it once I see the memory consumption go up in the windows service (above version)
Maybe (not too optimistic) the above change already fixes my leak..
But still my question: If the Process itself would be incorrectly handled (not disposed), wouldn't I see that in the managed memory?
34 replies
✅ Process API: Memory Leaks in Windows (?)
I found an older state here and I'm fully aware that the using/dispose is missing in that state.
I did add it and let it run for a while (with the disposal), but had no luck.
However, maybe it's worth a shot retrying just plain Process with all the other noise (thousands of CTS recreations) gone
34 replies
✅ Process API: Memory Leaks in Windows (?)
Yep.. Well, I did.. CliWrap's Process is not disposable.
As far as I can tell from going through the libraries source code the Process is disposed as expected.
In any case, wouldn't this, without being correctly disposed, show up as increasing managed memory (see dashboard above)
Edit: Trying to find the last version that still used Process for reference
Edit2: Squash merge ftw :/
34 replies