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
Expected: the property to be proxied but not intercepted.
Actual: the property is generated in the proxy but does not pass the value to the underlying instance
public class TestCacheProxyGenerationHook : AllMethodsHook
{
public override bool ShouldInterceptMethod(Type type, MethodInfo methodInfo)
{
return false;
}
}
public interface ITestCacheInterface
{
int InstanceProperty { get; set; }
}
public class TestClassForCache : ITestCacheInterface
{
public virtual int InstanceProperty { get; set; }
}
[Fact]
public async Task DynamicProxy_NonIntercepted_Property_Leaked()
{
var instance = new TestClassForCache();
var toProxy = instance.GetType();
var proxyGenerationOptions = new ProxyGenerationOptions(new TestCacheProxyGenerationHook());
var generator = new ProxyGenerator();
var proxy = generator.CreateClassProxyWithTarget(toProxy,
instance,
proxyGenerationOptions);
var accessor = (ITestCacheInterface)proxy;
accessor.InstanceProperty = 1;
Assert.Equal(accessor.InstanceProperty, instance.InstanceProperty); // Fails here 1 != 0
}
The text was updated successfully, but these errors were encountered:
Expected: the property to be proxied but not intercepted.
Actual: the property is generated in the proxy but does not pass the value to the underlying instance
The text was updated successfully, but these errors were encountered: