Open
Description
I have a request for advise in a specific situation.
In our library we have a cache with a GetOrCreate method. This is not an uncommon patterns, see, for instance, MemoryCache.GetOrCreateAsync.
The IDisposableAnalyzer warns that the caller should Dispose (Warning IDISP001 Dispose created), but since it is a cache we want to reuse the object later. The cache itself should call Dispose() in a cleanup routine.
This is our method
var paint = vectorCache.GetOrCreatePaint(vectorStyle.Outline, opacity, PolygonRenderer.CreateSkPaint);
CreateSkPaint is a function that is called inside the GetOrCreatePaint method. Turning it into a lambda did not help. Is there another way we could organize our code to circumvent the warning?
Metadata
Metadata
Assignees
Labels
No labels