You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
public class ServiceInstanceGenerator
{
private readonly LoggingInterceptor _loggingInterceptor;
private readonly ProxyGenerator _proxyGenerator;
public ServiceInstanceGenerator(LoggingInterceptor loggingInterceptor, ProxyGenerator proxyGenerator)
{
_loggingInterceptor = loggingInterceptor;
_proxyGenerator = proxyGenerator;
}
public TInterface GetActor<TInterface>(ActorId id) where TInterface : class, IActor
{
var service = ActorProxy.Create<TInterface>(id);
return _proxyGenerator.CreateInterfaceProxyWithTargetInterface(service, _loggingInterceptor);
}
public TInterface GetService<TInterface>(Uri uri) where TInterface : class, IService
{
var service = ServiceProxy.Create<TInterface>(uri);
return _proxyGenerator.CreateInterfaceProxyWithTargetInterface(service, _loggingInterceptor);
}
}
public class AssignmentsActor
{
private readonly Func<ActorId, ITransactions> _actorFactory;
public AssignmentsActor(Func<ActorId, ITransactions> actorFactory)
{
_actorFactory = actorFactory;
}
private ITransactions GetActor(ActorId id)
{
return _actorFactory(id);
}
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?
The text was updated successfully, but these errors were encountered:
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. :)
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?
The text was updated successfully, but these errors were encountered: