Assembly: PostSharp.Patterns.Caching (in PostSharp.Patterns.Caching.dll) Version: 220.127.116.11 (18.104.22.168)
public static IDisposable SuspendDependencyPropagation()
Return ValueType: IDisposable
IDisposable representation of the suspension. Disposing this object resumes the normal dependency propagation.
By default, calling a cached method while another CurrentContext is stored in an AsyncLocal<T> variable, it may be inadvertently used after the method call associated with it had already ended. This can happen, for example, when method calls and does not depend on the resulting Task.is active automatically adds the former as a dependency of the later. Since the
This context leak does not break correctness but may lead to unnecessary dependency invalidations. Therefore it is recommended to use this method when calling asynchronous code in the context of cached methods and not being dependent on its result.