summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs
index 4bc4ced0b9..230667b3a3 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs
@@ -248,11 +248,7 @@ namespace System.Runtime.Loader
foreach (WeakReference<AssemblyLoadContext> weakAlc in alcList)
{
- AssemblyLoadContext? alc = null;
-
- weakAlc.TryGetTarget(out alc);
-
- if (alc != null)
+ if (weakAlc.TryGetTarget(out AssemblyLoadContext? alc))
{
yield return alc;
}
@@ -428,7 +424,7 @@ namespace System.Runtime.Loader
{
foreach (var alcAlive in s_allContexts)
{
- if (alcAlive.Value.TryGetTarget(out AssemblyLoadContext alc))
+ if (alcAlive.Value.TryGetTarget(out AssemblyLoadContext? alc))
{
alc.RaiseUnloadEvent();
}