From afe34cdbfef684b1b2134932990c62df7707e67e Mon Sep 17 00:00:00 2001 From: Enderlook Date: Wed, 22 Feb 2023 13:14:12 -0300 Subject: [PATCH] Improve nullability annotations --- CHANGELOG.md | 5 +- .../Enderlook.EventManager.csproj | 2 +- .../src/EventManager.Weak.cs | 172 +++++++++--------- 3 files changed, 91 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d97c61..b03bd42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog ## -- Stop using implementation details of runtimes in order to make the code more safe and compatible with other runtimes. + +## v0.4.8 +- Stop using implementation details of runtimes in order to make the code safer and more compatible with other runtimes. +- Fix nullability annotations. ## v0.4.7 diff --git a/Enderlook.EventManager/Enderlook.EventManager.csproj b/Enderlook.EventManager/Enderlook.EventManager.csproj index a43c8da..0fba8e3 100644 --- a/Enderlook.EventManager/Enderlook.EventManager.csproj +++ b/Enderlook.EventManager/Enderlook.EventManager.csproj @@ -10,7 +10,7 @@ Enderlook.EventManager https://github.com/Enderlook/Net-Event-Manager git - 0.4.7 + 0.4.8 true true 11 diff --git a/Enderlook.EventManager/src/EventManager.Weak.cs b/Enderlook.EventManager/src/EventManager.Weak.cs index fc55c30..4243acb 100644 --- a/Enderlook.EventManager/src/EventManager.Weak.cs +++ b/Enderlook.EventManager/src/EventManager.Weak.cs @@ -88,7 +88,7 @@ public void WeakSubscribe(THandle handle, Action callback, Weak /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakSubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakSubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -101,19 +101,19 @@ public void WeakSubscribe(THandle handle, TClosure? c { if (trackResurrection) { - InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { - InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } else @@ -122,17 +122,17 @@ public void WeakSubscribe(THandle handle, TClosure? c { InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } } @@ -148,7 +148,7 @@ public void WeakSubscribe(THandle handle, TClosure? c /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakSubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakSubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -161,19 +161,19 @@ public void WeakSubscribe(THandle handle, TClosure? c { if (trackResurrection) { - InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { - InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } else @@ -182,17 +182,17 @@ public void WeakSubscribe(THandle handle, TClosure? c { InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } } @@ -208,7 +208,7 @@ public void WeakSubscribe(THandle handle, TClosure? c /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakSubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakSubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -221,19 +221,19 @@ public void WeakSubscribe(THandle handle, TClosure? c { if (trackResurrection) { - InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { - InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } else @@ -242,17 +242,17 @@ public void WeakSubscribe(THandle handle, TClosure? c { InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } } @@ -268,7 +268,7 @@ public void WeakSubscribe(THandle handle, TClosure? c /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakSubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakSubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -281,19 +281,19 @@ public void WeakSubscribe(THandle handle, TClosure? c { if (trackResurrection) { - InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandle callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandle>(callback_, listenToAssignableEvents); } else { - InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); + InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } else @@ -310,9 +310,9 @@ public void WeakSubscribe(THandle handle, TClosure? c { InvariantObjectAndTAndGCHandleTrackResurrection callback_ = new(callback, handle, closure); if (multipleRaises) - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); else - Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); + Subscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndTAndGCHandleTrackResurrection>(callback_, listenToAssignableEvents); } } } @@ -468,7 +468,7 @@ public void WeakUnsubscribe(THandle handle, Action callback, We /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakUnsubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakUnsubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -479,38 +479,38 @@ public void WeakUnsubscribe(THandle handle, TClosure? bool trackResurrection = (subscribeAttributes & WeakSubscribeFlags.TrackResurrection) == 0; if (typeof(TClosure).IsValueType) { - InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } else { - InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgument>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } } @@ -525,7 +525,7 @@ public void WeakUnsubscribe(THandle handle, TClosure? /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakUnsubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakUnsubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -536,38 +536,38 @@ public void WeakUnsubscribe(THandle handle, TClosure? bool trackResurrection = (subscribeAttributes & WeakSubscribeFlags.TrackResurrection) == 0; if (typeof(TClosure).IsValueType) { - InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } else { - InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoid>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } } @@ -582,7 +582,7 @@ public void WeakUnsubscribe(THandle handle, TClosure? /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakUnsubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakUnsubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -593,38 +593,38 @@ public void WeakUnsubscribe(THandle handle, TClosure? bool trackResurrection = (subscribeAttributes & WeakSubscribeFlags.TrackResurrection) == 0; if (typeof(TClosure).IsValueType) { - InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } else { - InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTArgumentWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } } @@ -639,7 +639,7 @@ public void WeakUnsubscribe(THandle handle, TClosure? /// Thrown when or is . /// Thrown when this instance has already been disposed. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WeakUnsubscribe(THandle handle, TClosure? closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) + public void WeakUnsubscribe(THandle handle, TClosure closure, Action callback, WeakSubscribeFlags subscribeAttributes = WeakSubscribeFlags.Default) where THandle : class { if (callback is null) ThrowNullCallbackException(); @@ -650,38 +650,38 @@ public void WeakUnsubscribe(THandle handle, TClosure? bool trackResurrection = (subscribeAttributes & WeakSubscribeFlags.TrackResurrection) == 0; if (typeof(TClosure).IsValueType) { - InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndValueTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } else { - InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle> predicator = new(callback, closure, handle); + InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle> predicator = new(callback, closure, handle); if (trackResurrection) { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandle>(predicator, listenToAssignableEvents); } else { if (multipleRaises) - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, No, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); else - Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure?, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); + Unsubscribe, WeakInvariantObjectAndTVoidWithHandle>, Yes, InvariantObjectAndReferenceTAndGCHandleComparer, TClosure, THandle>, InvariantObjectAndTAndGCHandleTrackResurrection>(predicator, listenToAssignableEvents); } } }