Print Page | Close Window

Async Navigation and PendingEntityListResolved

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4134
Printed Date: 12-May-2026 at 9:30pm


Topic: Async Navigation and PendingEntityListResolved
Posted By: LowOrbit
Subject: Async Navigation and PendingEntityListResolved
Date Posted: 02-May-2013 at 12:43pm
Hello
 
I was looking at the documentation about fetching a Navigation Property asyncronyously. Below is an example of a code snippet to fetch a nav property:
 
                RelatedEntityList<AnalysisDefinitionMethod> availableMethods = aResult.AnalysisDefinitionMethods;
                availableMethods.PendingEntityListResolved += (sender, args) => args.ResolvedEntities.ForEach(e => code to load the results);
My concern here is that creating an anonymous event handler of PendingEntityListResolved will cause a memory leak because the variable availableMethods will never get garbage collected. Is this true or will the event handler be released properly when availableMethods goes out of scope?
 
Thanks!
 
 



Replies:
Posted By: sbelini
Date Posted: 03-May-2013 at 11:25am
Hi LowOrbit,

After using .NET Memory Profiler, we were not able to see any memory leak due to creating event handlers as you described.
Based on that, I'd say it's safe to have anonymous event handlers on PendingEntityListResolved.



Print Page | Close Window