com.wallstop-studios.dxmessaging 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +315 -67
- package/CHANGELOG.md.meta +7 -7
- package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
- package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1129 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
- package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
- package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
- package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +46 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
- package/Editor/Analyzers.meta +8 -8
- package/Editor/AssemblyInfo.cs.meta +11 -3
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +429 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
- package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
- package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +11 -3
- package/Editor/CustomEditors.meta +2 -2
- package/Editor/DxMessagingEditorIdle.cs +62 -0
- package/Editor/DxMessagingEditorIdle.cs.meta +11 -0
- package/Editor/DxMessagingEditorInitializer.cs +112 -15
- package/Editor/DxMessagingEditorInitializer.cs.meta +11 -3
- package/Editor/DxMessagingEditorLog.cs +32 -0
- package/Editor/DxMessagingEditorLog.cs.meta +11 -0
- package/Editor/DxMessagingMenu.cs.meta +11 -11
- package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +313 -0
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
- package/Editor/Settings/DxMessagingSettings.cs +261 -11
- package/Editor/Settings/DxMessagingSettings.cs.meta +11 -3
- package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
- package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +11 -3
- package/Editor/Settings.meta +2 -2
- package/Editor/SetupCscRsp.cs +406 -39
- package/Editor/SetupCscRsp.cs.meta +11 -3
- package/Editor/Testing/MessagingComponentEditorHarness.cs +2 -2
- package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +11 -3
- package/Editor/Testing.meta +3 -3
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
- package/Editor.meta +8 -8
- package/LICENSE.md +9 -9
- package/LICENSE.md.meta +7 -7
- package/README.md +940 -900
- package/README.md.meta +7 -7
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
- package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes.meta +2 -2
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
- package/Runtime/Core/Configuration.meta +9 -0
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +46 -28
- package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -3
- package/Runtime/Core/DataStructure.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +11 -3
- package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +11 -3
- package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +11 -3
- package/Runtime/Core/Diagnostics.meta +2 -2
- package/Runtime/Core/DxMessagingStaticState.cs +19 -0
- package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
- package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
- package/Runtime/Core/Extensions/EnumExtensions.cs.meta +11 -3
- package/Runtime/Core/Extensions/IListExtensions.cs.meta +11 -3
- package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
- package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
- package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
- package/Runtime/Core/Extensions.meta +8 -8
- package/Runtime/Core/Helper/MessageCache.cs +32 -0
- package/Runtime/Core/Helper/MessageCache.cs.meta +11 -3
- package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +11 -3
- package/Runtime/Core/Helper.meta +2 -2
- package/Runtime/Core/IMessage.cs +3 -3
- package/Runtime/Core/IMessage.cs.meta +11 -11
- package/Runtime/Core/InstanceId.cs +25 -1
- package/Runtime/Core/InstanceId.cs.meta +11 -11
- package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
- package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
- package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
- package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlots.cs +597 -0
- package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
- package/Runtime/Core/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
- package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBus.cs +189 -15
- package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs +719 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/MessageBus.cs +5366 -3838
- package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
- package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
- package/Runtime/Core/MessageBus.meta +8 -8
- package/Runtime/Core/MessageHandler.cs +2399 -1042
- package/Runtime/Core/MessageHandler.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationToken.cs +429 -44
- package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
- package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +11 -3
- package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +11 -3
- package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/StringMessage.cs.meta +11 -3
- package/Runtime/Core/Messages.meta +8 -8
- package/Runtime/Core/MessagingDebug.cs.meta +11 -11
- package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
- package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
- package/Runtime/Core/Pooling/DxPools.cs +157 -0
- package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
- package/Runtime/Core/Pooling.meta +9 -0
- package/Runtime/Core.meta +8 -8
- package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
- package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Reflex.meta +8 -8
- package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/VContainer.meta +8 -8
- package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Zenject.meta +8 -8
- package/Runtime/Unity/Integrations.meta +8 -8
- package/Runtime/Unity/MessageAwareComponent.cs +74 -0
- package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
- package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
- package/Runtime/Unity/MessagingComponent.cs +43 -10
- package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
- package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
- package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity.meta +8 -8
- package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
- package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
- package/Runtime.meta +8 -8
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
- package/Samples~/DI/Prefabs.meta +8 -8
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers.meta +8 -8
- package/Samples~/DI/README.md +51 -51
- package/Samples~/DI/README.md.meta +7 -7
- package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
- package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Reflex.meta +8 -8
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
- package/Samples~/DI/VContainer.meta +8 -8
- package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
- package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Zenject.meta +8 -8
- package/Samples~/DI.meta +8 -8
- package/Samples~/Mini Combat/Boot.cs.meta +11 -11
- package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
- package/Samples~/Mini Combat/Messages.cs.meta +11 -11
- package/Samples~/Mini Combat/Player.cs.meta +11 -11
- package/Samples~/Mini Combat/README.md +324 -323
- package/Samples~/Mini Combat/README.md.meta +7 -7
- package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
- package/Samples~/Mini Combat/Walkthrough.md +430 -430
- package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
- package/Samples~/Mini Combat.meta +8 -8
- package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/README.md +210 -209
- package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
- package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
- package/Samples~/UI Buttons + Inspector.meta +8 -8
- package/SourceGenerators/Directory.Build.props +50 -3
- package/SourceGenerators/Directory.Build.props.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +11 -3
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +39 -46
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
- package/SourceGenerators/global.json +7 -0
- package/SourceGenerators/global.json.meta +7 -0
- package/SourceGenerators.meta +8 -8
- package/Third Party Notices.md +3 -3
- package/Third Party Notices.md.meta +7 -7
- package/package.json +102 -92
- package/package.json.meta +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: a1f4dd001abc18c4cafd24fa6e778268
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: a1f4dd001abc18c4cafd24fa6e778268
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9df8c16d3cffca545b374ec4cb1d5cad
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9df8c16d3cffca545b374ec4cb1d5cad
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -2,6 +2,7 @@ namespace DxMessaging.Core
|
|
|
2
2
|
{
|
|
3
3
|
using System;
|
|
4
4
|
using System.Collections.Generic;
|
|
5
|
+
using System.Runtime.ExceptionServices;
|
|
5
6
|
using DataStructure;
|
|
6
7
|
using Diagnostics;
|
|
7
8
|
using MessageBus;
|
|
@@ -58,8 +59,23 @@ namespace DxMessaging.Core
|
|
|
58
59
|
private readonly MessageHandler _messageHandler;
|
|
59
60
|
|
|
60
61
|
private readonly Dictionary<MessageRegistrationHandle, Action> _registrations = new();
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
// Staged-registration handles in registration order. Dictionary
|
|
64
|
+
// enumeration order is NOT stable across Remove/Add churn, so Enable()
|
|
65
|
+
// (and RetargetMessageBus) replay staged registrations by walking this
|
|
66
|
+
// list instead of _registrations.Values; otherwise a Disable()/Enable()
|
|
67
|
+
// cycle after churn would silently permute the documented
|
|
68
|
+
// "same priority uses registration order" dispatch contract.
|
|
69
|
+
// Invariant: contains exactly the keys of _registrations, in the order
|
|
70
|
+
// InternalRegister staged them (handle ids are monotonically
|
|
71
|
+
// increasing, so this list is also sorted by handle id).
|
|
72
|
+
private readonly List<MessageRegistrationHandle> _registrationOrder = new();
|
|
73
|
+
private readonly Dictionary<
|
|
74
|
+
MessageRegistrationHandle,
|
|
75
|
+
PendingDeregistration
|
|
76
|
+
> _deregistrations = new();
|
|
62
77
|
private readonly List<Action> _actionQueue = new();
|
|
78
|
+
private readonly List<MessageRegistrationHandle> _handleQueue = new();
|
|
63
79
|
internal readonly Dictionary<
|
|
64
80
|
MessageRegistrationHandle,
|
|
65
81
|
MessageRegistrationMetadata
|
|
@@ -1718,7 +1734,12 @@ namespace DxMessaging.Core
|
|
|
1718
1734
|
}
|
|
1719
1735
|
|
|
1720
1736
|
return InternalRegister(
|
|
1721
|
-
_ =>
|
|
1737
|
+
_ =>
|
|
1738
|
+
_messageHandler.RegisterUntargetedInterceptor(
|
|
1739
|
+
interceptor,
|
|
1740
|
+
priority: priority,
|
|
1741
|
+
messageBus: _messageBus
|
|
1742
|
+
),
|
|
1722
1743
|
() =>
|
|
1723
1744
|
new MessageRegistrationMetadata(
|
|
1724
1745
|
null,
|
|
@@ -1748,7 +1769,12 @@ namespace DxMessaging.Core
|
|
|
1748
1769
|
}
|
|
1749
1770
|
|
|
1750
1771
|
return InternalRegister(
|
|
1751
|
-
_ =>
|
|
1772
|
+
_ =>
|
|
1773
|
+
_messageHandler.RegisterBroadcastInterceptor(
|
|
1774
|
+
interceptor,
|
|
1775
|
+
priority: priority,
|
|
1776
|
+
messageBus: _messageBus
|
|
1777
|
+
),
|
|
1752
1778
|
() =>
|
|
1753
1779
|
new MessageRegistrationMetadata(
|
|
1754
1780
|
null,
|
|
@@ -1778,7 +1804,12 @@ namespace DxMessaging.Core
|
|
|
1778
1804
|
}
|
|
1779
1805
|
|
|
1780
1806
|
return InternalRegister(
|
|
1781
|
-
_ =>
|
|
1807
|
+
_ =>
|
|
1808
|
+
_messageHandler.RegisterTargetedInterceptor(
|
|
1809
|
+
interceptor,
|
|
1810
|
+
priority: priority,
|
|
1811
|
+
messageBus: _messageBus
|
|
1812
|
+
),
|
|
1782
1813
|
() =>
|
|
1783
1814
|
new MessageRegistrationMetadata(
|
|
1784
1815
|
null,
|
|
@@ -1804,6 +1835,7 @@ namespace DxMessaging.Core
|
|
|
1804
1835
|
MessageRegistrationHandle.CreateMessageRegistrationHandle();
|
|
1805
1836
|
|
|
1806
1837
|
_registrations[handle] = Registration;
|
|
1838
|
+
_registrationOrder.Add(handle);
|
|
1807
1839
|
_metadata[handle] = metadataProducer();
|
|
1808
1840
|
|
|
1809
1841
|
// Generally, registrations should take place before all calls to enable. Just in case, though...
|
|
@@ -1818,7 +1850,7 @@ namespace DxMessaging.Core
|
|
|
1818
1850
|
void Registration()
|
|
1819
1851
|
{
|
|
1820
1852
|
Action actualDeregistration = registerAndGetDeregistration(handle);
|
|
1821
|
-
|
|
1853
|
+
AddDeregistration(handle, actualDeregistration);
|
|
1822
1854
|
}
|
|
1823
1855
|
}
|
|
1824
1856
|
|
|
@@ -1843,12 +1875,15 @@ namespace DxMessaging.Core
|
|
|
1843
1875
|
|
|
1844
1876
|
if (_registrations is { Count: > 0 })
|
|
1845
1877
|
{
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1878
|
+
// Replay staged registrations in original registration order
|
|
1879
|
+
// (via _registrationOrder) rather than in
|
|
1880
|
+
// _registrations.Values enumeration order, which permutes
|
|
1881
|
+
// after Remove/Add churn. This preserves the documented
|
|
1882
|
+
// equal-priority "registration order" dispatch contract across
|
|
1883
|
+
// Disable()/Enable() cycles. Snapshot into _actionQueue first
|
|
1884
|
+
// so replay tolerates re-entrant registration mutation.
|
|
1885
|
+
QueueRegistrationsInOrder();
|
|
1886
|
+
InvokeRegistrationQueueWithRollback();
|
|
1852
1887
|
}
|
|
1853
1888
|
|
|
1854
1889
|
_enabled = true;
|
|
@@ -1867,28 +1902,21 @@ namespace DxMessaging.Core
|
|
|
1867
1902
|
/// </example>
|
|
1868
1903
|
public void Disable()
|
|
1869
1904
|
{
|
|
1870
|
-
if (!_enabled)
|
|
1905
|
+
if (!_enabled && _deregistrations.Count == 0)
|
|
1871
1906
|
{
|
|
1872
1907
|
return;
|
|
1873
1908
|
}
|
|
1874
1909
|
|
|
1875
|
-
|
|
1910
|
+
Exception deregistrationException = InvokeDeregistrationQueue();
|
|
1911
|
+
_enabled = _deregistrations.Count > 0;
|
|
1912
|
+
if (deregistrationException != null)
|
|
1876
1913
|
{
|
|
1877
|
-
|
|
1878
|
-
_actionQueue.AddRange(_deregistrations.Values);
|
|
1879
|
-
foreach (Action deregistration in _actionQueue)
|
|
1880
|
-
{
|
|
1881
|
-
deregistration?.Invoke();
|
|
1882
|
-
}
|
|
1914
|
+
ExceptionDispatchInfo.Capture(deregistrationException).Throw();
|
|
1883
1915
|
}
|
|
1884
|
-
|
|
1885
|
-
// ReSharper disable once ForCanBeConvertedToForeach
|
|
1886
|
-
|
|
1887
|
-
_enabled = false;
|
|
1888
1916
|
}
|
|
1889
1917
|
|
|
1890
1918
|
/// <summary>
|
|
1891
|
-
/// Disables the token and clears all registrations and
|
|
1919
|
+
/// Disables the token and clears all registrations, de-registrations, and token-local diagnostic state.
|
|
1892
1920
|
/// </summary>
|
|
1893
1921
|
/// <example>
|
|
1894
1922
|
/// <code>
|
|
@@ -1899,19 +1927,19 @@ namespace DxMessaging.Core
|
|
|
1899
1927
|
/// </example>
|
|
1900
1928
|
public void UnregisterAll()
|
|
1901
1929
|
{
|
|
1902
|
-
|
|
1930
|
+
Exception deregistrationException = InvokeDeregistrationQueue();
|
|
1931
|
+
if (deregistrationException == null)
|
|
1903
1932
|
{
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
}
|
|
1933
|
+
_enabled = false;
|
|
1934
|
+
_registrations?.Clear();
|
|
1935
|
+
_registrationOrder?.Clear();
|
|
1936
|
+
ClearDiagnosticState();
|
|
1937
|
+
return;
|
|
1910
1938
|
}
|
|
1911
1939
|
|
|
1912
|
-
_enabled =
|
|
1913
|
-
|
|
1914
|
-
|
|
1940
|
+
_enabled = _deregistrations.Count > 0;
|
|
1941
|
+
PruneRegistrationStateToFailedDeregistrations();
|
|
1942
|
+
ExceptionDispatchInfo.Capture(deregistrationException).Throw();
|
|
1915
1943
|
}
|
|
1916
1944
|
|
|
1917
1945
|
/// <summary>
|
|
@@ -1938,27 +1966,333 @@ namespace DxMessaging.Core
|
|
|
1938
1966
|
return;
|
|
1939
1967
|
}
|
|
1940
1968
|
|
|
1969
|
+
IMessageBus previousMessageBus = _messageBus;
|
|
1970
|
+
List<MessageRegistrationHandle> activeRetargetHandles = rebindActiveRegistrations
|
|
1971
|
+
? new List<MessageRegistrationHandle>(_deregistrations.Keys)
|
|
1972
|
+
: null;
|
|
1941
1973
|
if (rebindActiveRegistrations)
|
|
1942
1974
|
{
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
foreach (Action deregistration in _actionQueue)
|
|
1975
|
+
Exception deregistrationException = InvokeDeregistrationQueue();
|
|
1976
|
+
if (deregistrationException != null)
|
|
1946
1977
|
{
|
|
1947
|
-
|
|
1978
|
+
RestoreMissingRegistrationsAfterRetargetDeregistrationFailure(
|
|
1979
|
+
previousMessageBus,
|
|
1980
|
+
activeRetargetHandles
|
|
1981
|
+
);
|
|
1982
|
+
_enabled = _deregistrations.Count > 0;
|
|
1983
|
+
ExceptionDispatchInfo.Capture(deregistrationException).Throw();
|
|
1948
1984
|
}
|
|
1985
|
+
|
|
1986
|
+
_enabled = false;
|
|
1949
1987
|
}
|
|
1950
1988
|
|
|
1951
1989
|
_messageBus = messageBus;
|
|
1952
1990
|
|
|
1953
1991
|
if (rebindActiveRegistrations && _registrations is { Count: > 0 })
|
|
1992
|
+
{
|
|
1993
|
+
// Mirror Enable(): rebind in original registration order so the
|
|
1994
|
+
// equal-priority dispatch order survives a bus retarget.
|
|
1995
|
+
QueueRegistrationsInOrder();
|
|
1996
|
+
try
|
|
1997
|
+
{
|
|
1998
|
+
InvokeRegistrationQueueWithRollback();
|
|
1999
|
+
_enabled = true;
|
|
2000
|
+
}
|
|
2001
|
+
catch (Exception exception)
|
|
2002
|
+
{
|
|
2003
|
+
RestoreRegistrationsAfterRetargetFailure(previousMessageBus);
|
|
2004
|
+
ExceptionDispatchInfo.Capture(exception).Throw();
|
|
2005
|
+
throw;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
private void AddDeregistration(MessageRegistrationHandle handle, Action deregistration)
|
|
2011
|
+
{
|
|
2012
|
+
if (!_deregistrations.TryGetValue(handle, out PendingDeregistration pending))
|
|
2013
|
+
{
|
|
2014
|
+
pending = new PendingDeregistration();
|
|
2015
|
+
_deregistrations[handle] = pending;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
pending.Add(deregistration);
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
private Dictionary<MessageRegistrationHandle, int> SnapshotDeregistrationCounts()
|
|
2022
|
+
{
|
|
2023
|
+
Dictionary<MessageRegistrationHandle, int> snapshot = new(_deregistrations.Count);
|
|
2024
|
+
foreach (
|
|
2025
|
+
KeyValuePair<
|
|
2026
|
+
MessageRegistrationHandle,
|
|
2027
|
+
PendingDeregistration
|
|
2028
|
+
> entry in _deregistrations
|
|
2029
|
+
)
|
|
2030
|
+
{
|
|
2031
|
+
snapshot[entry.Key] = entry.Value.Count;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
return snapshot;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
private void RestoreMissingRegistrationsAfterRetargetDeregistrationFailure(
|
|
2038
|
+
IMessageBus previousMessageBus,
|
|
2039
|
+
List<MessageRegistrationHandle> activeRetargetHandles
|
|
2040
|
+
)
|
|
2041
|
+
{
|
|
2042
|
+
_messageBus = previousMessageBus;
|
|
2043
|
+
if (activeRetargetHandles == null || activeRetargetHandles.Count == 0)
|
|
2044
|
+
{
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
QueueMissingRegistrationsInOrder(activeRetargetHandles);
|
|
2049
|
+
try
|
|
2050
|
+
{
|
|
2051
|
+
InvokeRegistrationQueueWithRollback();
|
|
2052
|
+
}
|
|
2053
|
+
catch (Exception exception)
|
|
2054
|
+
{
|
|
2055
|
+
if (MessagingDebug.enabled)
|
|
2056
|
+
{
|
|
2057
|
+
MessagingDebug.Log(
|
|
2058
|
+
LogLevel.Error,
|
|
2059
|
+
"Failed to restore registrations after retarget deregistration failure: {0}",
|
|
2060
|
+
exception
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
private void RestoreRegistrationsAfterRetargetFailure(IMessageBus previousMessageBus)
|
|
2067
|
+
{
|
|
2068
|
+
_messageBus = previousMessageBus;
|
|
2069
|
+
if (_registrations.Count == 0)
|
|
2070
|
+
{
|
|
2071
|
+
_enabled = false;
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
QueueRegistrationsWithoutRetryableDeregistrationsInOrder();
|
|
2076
|
+
try
|
|
2077
|
+
{
|
|
2078
|
+
InvokeRegistrationQueueWithRollback();
|
|
2079
|
+
_enabled = true;
|
|
2080
|
+
}
|
|
2081
|
+
catch (Exception restoreException)
|
|
2082
|
+
{
|
|
2083
|
+
_enabled = _deregistrations.Count > 0;
|
|
2084
|
+
if (MessagingDebug.enabled)
|
|
2085
|
+
{
|
|
2086
|
+
MessagingDebug.Log(
|
|
2087
|
+
LogLevel.Error,
|
|
2088
|
+
"Failed to restore registrations after retarget replay failure: {0}",
|
|
2089
|
+
restoreException
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
private void QueueRegistrationsInOrder()
|
|
2096
|
+
{
|
|
2097
|
+
_actionQueue.Clear();
|
|
2098
|
+
int registrationCount = _registrationOrder.Count;
|
|
2099
|
+
for (int i = 0; i < registrationCount; ++i)
|
|
2100
|
+
{
|
|
2101
|
+
if (_registrations.TryGetValue(_registrationOrder[i], out Action registration))
|
|
2102
|
+
{
|
|
2103
|
+
_actionQueue.Add(registration);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
private void QueueMissingRegistrationsInOrder(
|
|
2109
|
+
List<MessageRegistrationHandle> activeRetargetHandles
|
|
2110
|
+
)
|
|
2111
|
+
{
|
|
2112
|
+
_actionQueue.Clear();
|
|
2113
|
+
int registrationCount = _registrationOrder.Count;
|
|
2114
|
+
for (int i = 0; i < registrationCount; ++i)
|
|
2115
|
+
{
|
|
2116
|
+
MessageRegistrationHandle handle = _registrationOrder[i];
|
|
2117
|
+
if (
|
|
2118
|
+
!activeRetargetHandles.Contains(handle)
|
|
2119
|
+
|| _deregistrations.ContainsKey(handle)
|
|
2120
|
+
|| !_registrations.TryGetValue(handle, out Action registration)
|
|
2121
|
+
)
|
|
2122
|
+
{
|
|
2123
|
+
continue;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
_actionQueue.Add(registration);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
private void QueueRegistrationsWithoutRetryableDeregistrationsInOrder()
|
|
2131
|
+
{
|
|
2132
|
+
_actionQueue.Clear();
|
|
2133
|
+
int registrationCount = _registrationOrder.Count;
|
|
2134
|
+
for (int i = 0; i < registrationCount; ++i)
|
|
2135
|
+
{
|
|
2136
|
+
MessageRegistrationHandle handle = _registrationOrder[i];
|
|
2137
|
+
if (
|
|
2138
|
+
_deregistrations.ContainsKey(handle)
|
|
2139
|
+
|| !_registrations.TryGetValue(handle, out Action registration)
|
|
2140
|
+
)
|
|
2141
|
+
{
|
|
2142
|
+
continue;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
_actionQueue.Add(registration);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
private void InvokeActionQueue()
|
|
2150
|
+
{
|
|
2151
|
+
try
|
|
2152
|
+
{
|
|
2153
|
+
foreach (Action action in _actionQueue)
|
|
2154
|
+
{
|
|
2155
|
+
action?.Invoke();
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
finally
|
|
1954
2159
|
{
|
|
1955
2160
|
_actionQueue.Clear();
|
|
1956
|
-
|
|
1957
|
-
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
private Exception InvokeDeregistrationQueue(
|
|
2165
|
+
Dictionary<MessageRegistrationHandle, int> baselineCounts = null
|
|
2166
|
+
)
|
|
2167
|
+
{
|
|
2168
|
+
if (_deregistrations.Count == 0)
|
|
2169
|
+
{
|
|
2170
|
+
return null;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
bool scopedToAddedDeregistrations = baselineCounts != null;
|
|
2174
|
+
_handleQueue.Clear();
|
|
2175
|
+
_handleQueue.AddRange(_deregistrations.Keys);
|
|
2176
|
+
Exception firstException = null;
|
|
2177
|
+
try
|
|
2178
|
+
{
|
|
2179
|
+
foreach (MessageRegistrationHandle handle in _handleQueue)
|
|
2180
|
+
{
|
|
2181
|
+
if (!_deregistrations.TryGetValue(handle, out PendingDeregistration pending))
|
|
2182
|
+
{
|
|
2183
|
+
continue;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
int startIndex = 0;
|
|
2187
|
+
if (scopedToAddedDeregistrations)
|
|
2188
|
+
{
|
|
2189
|
+
if (baselineCounts.TryGetValue(handle, out int baselineCount))
|
|
2190
|
+
{
|
|
2191
|
+
startIndex = baselineCount;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
if (startIndex >= pending.Count)
|
|
2195
|
+
{
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
Exception exception = pending.InvokeFrom(startIndex);
|
|
2201
|
+
if (exception != null)
|
|
2202
|
+
{
|
|
2203
|
+
firstException ??= exception;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
if (pending.Count == 0)
|
|
2207
|
+
{
|
|
2208
|
+
_deregistrations.Remove(handle);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
finally
|
|
2213
|
+
{
|
|
2214
|
+
_handleQueue.Clear();
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
return firstException;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
private void InvokeRegistrationQueueWithRollback()
|
|
2221
|
+
{
|
|
2222
|
+
Dictionary<MessageRegistrationHandle, int> rollbackBaseline =
|
|
2223
|
+
SnapshotDeregistrationCounts();
|
|
2224
|
+
try
|
|
2225
|
+
{
|
|
2226
|
+
InvokeActionQueue();
|
|
2227
|
+
}
|
|
2228
|
+
catch (Exception exception)
|
|
2229
|
+
{
|
|
2230
|
+
RollBackDeregistrationsAfterRegistrationFailure(rollbackBaseline);
|
|
2231
|
+
_enabled = _deregistrations.Count > 0;
|
|
2232
|
+
ExceptionDispatchInfo.Capture(exception).Throw();
|
|
2233
|
+
throw;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
private void RollBackDeregistrationsAfterRegistrationFailure(
|
|
2238
|
+
Dictionary<MessageRegistrationHandle, int> rollbackBaseline
|
|
2239
|
+
)
|
|
2240
|
+
{
|
|
2241
|
+
if (_deregistrations.Count == 0)
|
|
2242
|
+
{
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
Exception rollbackException = InvokeDeregistrationQueue(rollbackBaseline);
|
|
2247
|
+
if (rollbackException != null && MessagingDebug.enabled)
|
|
2248
|
+
{
|
|
2249
|
+
MessagingDebug.Log(
|
|
2250
|
+
LogLevel.Error,
|
|
2251
|
+
"Failed to roll back partial registration after token replay failure: {0}",
|
|
2252
|
+
rollbackException
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
private void ClearDiagnosticState()
|
|
2258
|
+
{
|
|
2259
|
+
_metadata.Clear();
|
|
2260
|
+
_callCounts.Clear();
|
|
2261
|
+
_emissionBuffer.Clear();
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
private void PruneRegistrationStateToFailedDeregistrations()
|
|
2265
|
+
{
|
|
2266
|
+
for (int i = _registrationOrder.Count - 1; i >= 0; --i)
|
|
2267
|
+
{
|
|
2268
|
+
MessageRegistrationHandle handle = _registrationOrder[i];
|
|
2269
|
+
if (_deregistrations.ContainsKey(handle))
|
|
1958
2270
|
{
|
|
1959
|
-
|
|
2271
|
+
continue;
|
|
1960
2272
|
}
|
|
2273
|
+
|
|
2274
|
+
RemoveRegistrationState(handle);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
_emissionBuffer.Clear();
|
|
2278
|
+
if (_registrations.Count == 0)
|
|
2279
|
+
{
|
|
2280
|
+
ClearDiagnosticState();
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
private bool RemoveRegistrationState(MessageRegistrationHandle handle)
|
|
2285
|
+
{
|
|
2286
|
+
bool removedRegistration = _registrations.Remove(handle);
|
|
2287
|
+
_ = _registrationOrder.Remove(handle);
|
|
2288
|
+
_ = _metadata.Remove(handle);
|
|
2289
|
+
_ = _callCounts.Remove(handle);
|
|
2290
|
+
if (removedRegistration && _registrations.Count == 0)
|
|
2291
|
+
{
|
|
2292
|
+
ClearDiagnosticState();
|
|
1961
2293
|
}
|
|
2294
|
+
|
|
2295
|
+
return removedRegistration;
|
|
1962
2296
|
}
|
|
1963
2297
|
|
|
1964
2298
|
/// <summary>
|
|
@@ -1973,9 +2307,60 @@ namespace DxMessaging.Core
|
|
|
1973
2307
|
/// </example>
|
|
1974
2308
|
public void RemoveRegistration(MessageRegistrationHandle handle)
|
|
1975
2309
|
{
|
|
1976
|
-
if (_deregistrations
|
|
2310
|
+
if (_deregistrations.TryGetValue(handle, out PendingDeregistration pending))
|
|
1977
2311
|
{
|
|
1978
|
-
|
|
2312
|
+
Exception deregistrationException = pending.InvokeFrom(0);
|
|
2313
|
+
if (pending.Count == 0)
|
|
2314
|
+
{
|
|
2315
|
+
_deregistrations.Remove(handle);
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
if (deregistrationException != null)
|
|
2319
|
+
{
|
|
2320
|
+
ExceptionDispatchInfo.Capture(deregistrationException).Throw();
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
// Drop the matching staged registration and metadata so a later
|
|
2325
|
+
// Disable()/Enable() cycle does not silently re-register the
|
|
2326
|
+
// handler we were just asked to remove.
|
|
2327
|
+
RemoveRegistrationState(handle);
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
private sealed class PendingDeregistration
|
|
2331
|
+
{
|
|
2332
|
+
private readonly List<Action> _actions = new();
|
|
2333
|
+
|
|
2334
|
+
internal int Count => _actions.Count;
|
|
2335
|
+
|
|
2336
|
+
internal void Add(Action action)
|
|
2337
|
+
{
|
|
2338
|
+
_actions.Add(action);
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
internal Exception InvokeFrom(int startIndex)
|
|
2342
|
+
{
|
|
2343
|
+
if (startIndex < 0)
|
|
2344
|
+
{
|
|
2345
|
+
startIndex = 0;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
Exception firstException = null;
|
|
2349
|
+
for (int i = startIndex; i < _actions.Count; )
|
|
2350
|
+
{
|
|
2351
|
+
try
|
|
2352
|
+
{
|
|
2353
|
+
_actions[i]?.Invoke();
|
|
2354
|
+
_actions.RemoveAt(i);
|
|
2355
|
+
}
|
|
2356
|
+
catch (Exception exception)
|
|
2357
|
+
{
|
|
2358
|
+
firstException ??= exception;
|
|
2359
|
+
++i;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
return firstException;
|
|
1979
2364
|
}
|
|
1980
2365
|
}
|
|
1981
2366
|
|
|
@@ -2045,7 +2430,7 @@ namespace DxMessaging.Core
|
|
|
2045
2430
|
}
|
|
2046
2431
|
|
|
2047
2432
|
/// <summary>
|
|
2048
|
-
/// Removes all staged registrations and
|
|
2433
|
+
/// Removes all staged registrations and clears token-local diagnostic state.
|
|
2049
2434
|
/// </summary>
|
|
2050
2435
|
public void Dispose()
|
|
2051
2436
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d5dce65290c6c424b870b19b6353e6b1
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d5dce65290c6c424b870b19b6353e6b1
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 58b2b780f9844aeb8929eeca855ba3be
|
|
3
|
-
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 58b2b780f9844aeb8929eeca855ba3be
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: ef4b123d67e3bcd4a8ebe2f18b3acbf9
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ef4b123d67e3bcd4a8ebe2f18b3acbf9
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|