Closed kdma closed 2 weeks ago
This appears to be more of an issue with your DI container than with DynamicProxy per se. Perhaps .SingleInstance()
doesn't do what you think it does? (For example, it might create a single instance per web request or something like that.) Either way, I'm afraid you might be at the wrong repository here.
Hi stakx, Thanks I believe its something in between Autofac and Castle and of course SF the mother of all the beasts not playing nicely with each other. I am going to crosspost there as suggested and update here for anyone wandering in the future. :)
@kdma, I am closing this (by now pretty stale) issue, as I still don't see how this problem could be solved on DynamicProxy's side (which is what this repo is for). Our guidance is clear: you're encouraged to reuse ProxyGenerator
instances in order to benefit from proxy type caching (see the documentation). Since in your case it is Autofac that instantiates the ProxyGenerator
instance(s), and it's perhaps Service Fabric that controls the Autofac container(s) lifetime(s), I think you'd need to solve the problem there.
Hi we have a Service Fabic cluster and we use Castle.Core.AsyncInterceptor (2.0.0 which has dependency towards Castle.Core 4.4.0) for telemetry injection, we noticed DynamicProxyGenAssembly2 modules leaking.
This is the setup for classes and DI:
We tought that by registering the dependencies as single istance and the factory we could prevent the DynamicProxyGenLeaking but with this setup we can find this in the dumps:
Is our reasoning correct?