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
Use AssemblyLoadContext-aware caches in TypeDescriptor to support unloading of assemblies cached by TypeDescriptor (#114619)
* Use separate hashtables for collectible types to support assembly unloadability for the TypeDescriptor class
* Addressed codereview feedback
* Added a test for custom provider and updated WeakHashTable to use ConditionalWeakTable to ensure values can be also colelcted
* Renamed ContextAwareHashtable to CollectibleKeyHashtable
// Licensed to the .NET Foundation under one or more agreements.
2
+
// The .NET Foundation licenses this file to you under the MIT license.
3
+
4
+
usingSystem.Collections;
5
+
usingSystem.Reflection;
6
+
usingSystem.Runtime.CompilerServices;
7
+
8
+
namespaceSystem.ComponentModel
9
+
{
10
+
/// <summary>
11
+
/// Hashtable that maps a <see cref="MemberInfo"/> object key to an associated value.
12
+
/// <para>
13
+
/// For keys where <see cref="MemberInfo.IsCollectible"/> is <c>false</c>, a standard <see cref="Hashtable"/> is used.
14
+
/// For keys where <see cref="MemberInfo.IsCollectible"/> is <c>true</c>, a <see cref="ConditionalWeakTable{TKey, TValue}"/> is used.
15
+
/// This ensures that collectible <see cref="MemberInfo"/> instances (such as those from collectible assemblies) do not prevent their assemblies from being unloaded.
Copy file name to clipboardExpand all lines: src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs
0 commit comments