@@ -298,7 +298,7 @@ internal struct JoinableTaskDependentData
298298 /// When the value in an entry is decremented to 0, the entry is removed from the map.
299299 /// </remarks>
300300 [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
301- private WeakKeyDictionary < IJoinableTaskDependent , int > childDependentNodes ;
301+ private Dictionary < IJoinableTaskDependent , int > childDependentNodes ;
302302
303303 /// <summary>
304304 /// The head of a singly linked list of records to track which task may process events of this task.
@@ -309,7 +309,7 @@ internal struct JoinableTaskDependentData
309309 /// <summary>
310310 /// Gets a value indicating whether the <see cref="childDependentNodes"/> is empty.
311311 /// </summary>
312- internal bool HasNoChildDependentNode => this . childDependentNodes is null || this . childDependentNodes . Count == 0 || ! this . childDependentNodes . Any ( ) ;
312+ internal bool HasNoChildDependentNode => this . childDependentNodes is null || this . childDependentNodes . Count == 0 ;
313313
314314 /// <summary>
315315 /// Gets a snapshot of all joined tasks.
@@ -360,7 +360,7 @@ internal static JoinableTaskCollection.JoinRelease AddDependency(IJoinableTaskDe
360360 ref JoinableTaskDependentData data = ref parentTaskOrCollection . GetJoinableTaskDependentData ( ) ;
361361 if ( data . childDependentNodes is null )
362362 {
363- data . childDependentNodes = new WeakKeyDictionary < IJoinableTaskDependent , int > ( capacity : 2 ) ;
363+ data . childDependentNodes = new Dictionary < IJoinableTaskDependent , int > ( capacity : 2 ) ;
364364 }
365365
366366 if ( data . childDependentNodes . TryGetValue ( joinChild , out int refCount ) && ! parentTaskOrCollection . NeedRefCountChildDependencies )
@@ -479,7 +479,7 @@ internal static void AddSelfAndDescendentOrJoinedJobs(IJoinableTaskDependent tas
479479 }
480480 }
481481
482- WeakKeyDictionary < IJoinableTaskDependent , int > ? childDependentNodes = taskOrCollection . GetJoinableTaskDependentData ( ) . childDependentNodes ;
482+ Dictionary < IJoinableTaskDependent , int > ? childDependentNodes = taskOrCollection . GetJoinableTaskDependentData ( ) . childDependentNodes ;
483483 if ( childDependentNodes is object )
484484 {
485485 foreach ( KeyValuePair < IJoinableTaskDependent , int > item in childDependentNodes )
@@ -563,7 +563,7 @@ internal static void ComputeSelfAndDescendentOrJoinedJobsAndRemainTasks(IJoinabl
563563 return ;
564564 }
565565
566- WeakKeyDictionary < IJoinableTaskDependent , int > ? dependencies = taskOrCollection . GetJoinableTaskDependentData ( ) . childDependentNodes ;
566+ Dictionary < IJoinableTaskDependent , int > ? dependencies = taskOrCollection . GetJoinableTaskDependentData ( ) . childDependentNodes ;
567567 if ( dependencies is object )
568568 {
569569 foreach ( KeyValuePair < IJoinableTaskDependent , int > item in dependencies )
@@ -691,7 +691,7 @@ internal void OnTaskCompleted(IJoinableTaskDependent thisDependentNode)
691691
692692 if ( this . childDependentNodes is object )
693693 {
694- var childrenTasks = new List < IJoinableTaskDependent > ( this . childDependentNodes . Keys ) ;
694+ Dictionary < IJoinableTaskDependent , int > . KeyCollection ? childrenTasks = this . childDependentNodes . Keys ;
695695 while ( existingTaskTracking is object )
696696 {
697697 RemoveDependingSynchronousTaskFrom ( childrenTasks , existingTaskTracking . SynchronousTask , force : existingTaskTracking . SynchronousTask == thisDependentNode ) ;
@@ -901,7 +901,7 @@ private static void RemoveDependingSynchronousTask(IJoinableTaskDependent taskOr
901901 /// <param name="tasks">A list of tasks we need update the tracking list.</param>
902902 /// <param name="syncTask">The synchronous task we want to remove.</param>
903903 /// <param name="force">We always remove it from the tracking list if it is true. Otherwise, we keep tracking the reference count.</param>
904- private static void RemoveDependingSynchronousTaskFrom ( IReadOnlyList < IJoinableTaskDependent > tasks , JoinableTask syncTask , bool force )
904+ private static void RemoveDependingSynchronousTaskFrom ( IReadOnlyCollection < IJoinableTaskDependent > tasks , JoinableTask syncTask , bool force )
905905 {
906906 Requires . NotNull ( tasks , nameof ( tasks ) ) ;
907907 Requires . NotNull ( syncTask , nameof ( syncTask ) ) ;
0 commit comments