com.wallstop-studios.dxmessaging 3.0.1 → 3.2.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +497 -2
  2. package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +3 -3
  3. package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +3 -3
  4. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +69 -62
  5. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +3 -3
  6. package/Editor/AssemblyInfo.cs.meta +9 -1
  7. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +3 -3
  8. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +24 -15
  9. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +3 -3
  10. package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +9 -1
  11. package/Editor/DxMessagingEditorIdle.cs +62 -0
  12. package/{Runtime/Core/Internal/TypedDispatchLinkIndex.cs.meta → Editor/DxMessagingEditorIdle.cs.meta} +1 -1
  13. package/Editor/DxMessagingEditorInitializer.cs +112 -15
  14. package/Editor/DxMessagingEditorInitializer.cs.meta +9 -1
  15. package/Editor/DxMessagingEditorLog.cs +32 -0
  16. package/Editor/DxMessagingEditorLog.cs.meta +11 -0
  17. package/Editor/DxMessagingMenu.cs.meta +3 -3
  18. package/Editor/DxMessagingSceneBuildProcessor.cs.meta +3 -3
  19. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +137 -15
  20. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +3 -3
  21. package/Editor/Settings/DxMessagingSettings.cs +92 -31
  22. package/Editor/Settings/DxMessagingSettings.cs.meta +9 -1
  23. package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +9 -1
  24. package/Editor/SetupCscRsp.cs +539 -304
  25. package/Editor/SetupCscRsp.cs.meta +9 -1
  26. package/Editor/Testing/MessagingComponentEditorHarness.cs +1 -1
  27. package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +9 -1
  28. package/README.md +17 -18
  29. package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +3 -3
  30. package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.dll.meta +3 -3
  31. package/{Editor → Runtime}/Analyzers/System.Collections.Immutable.dll.meta +3 -3
  32. package/{Editor → Runtime}/Analyzers/System.Reflection.Metadata.dll.meta +3 -3
  33. package/{Editor → Runtime}/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +3 -3
  34. package/Runtime/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  35. package/Runtime/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +46 -0
  36. package/Runtime/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  37. package/{Editor → Runtime}/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +2 -2
  38. package/Runtime/Analyzers.meta +8 -0
  39. package/Runtime/AssemblyInfo.cs.meta +9 -1
  40. package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +9 -1
  41. package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +9 -1
  42. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +3 -3
  43. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
  44. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +9 -1
  45. package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +9 -1
  46. package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +9 -1
  47. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
  48. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
  49. package/Runtime/Core/DataStructure/CyclicBuffer.cs +44 -26
  50. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +9 -1
  51. package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +9 -1
  52. package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +9 -1
  53. package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +9 -1
  54. package/Runtime/Core/DxMessagingStaticState.cs.meta +3 -3
  55. package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
  56. package/Runtime/Core/Extensions/EnumExtensions.cs.meta +9 -1
  57. package/Runtime/Core/Extensions/IListExtensions.cs.meta +9 -1
  58. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +3 -3
  59. package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
  60. package/Runtime/Core/Extensions/MessageExtensions.cs.meta +3 -3
  61. package/Runtime/Core/Helper/MessageCache.cs.meta +9 -1
  62. package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +9 -1
  63. package/Runtime/Core/IMessage.cs.meta +3 -3
  64. package/Runtime/Core/InstanceId.cs +25 -1
  65. package/Runtime/Core/InstanceId.cs.meta +3 -3
  66. package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
  67. package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
  68. package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
  69. package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
  70. package/Runtime/Core/Internal/TypedSlots.cs +47 -21
  71. package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +3 -3
  72. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +3 -3
  73. package/Runtime/Core/MessageBus/IMessageBus.cs +75 -40
  74. package/Runtime/Core/MessageBus/IMessageBus.cs.meta +3 -3
  75. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +3 -3
  76. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
  77. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +3 -3
  78. package/Runtime/Core/MessageBus/Internal/BusSlots.cs +7 -6
  79. package/Runtime/Core/MessageBus/MessageBus.cs +2864 -3413
  80. package/Runtime/Core/MessageBus/MessageBus.cs.meta +3 -3
  81. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +3 -3
  82. package/Runtime/Core/MessageBus/MessageBusRegistration.cs +207 -0
  83. package/Runtime/Core/MessageBus/MessageBusRegistration.cs.meta +11 -0
  84. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
  85. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +3 -3
  86. package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +3 -3
  87. package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +3 -3
  88. package/Runtime/Core/MessageHandler.cs +2206 -1510
  89. package/Runtime/Core/MessageHandler.cs.meta +3 -3
  90. package/Runtime/Core/MessageRegistrationHandle.cs.meta +3 -3
  91. package/Runtime/Core/MessageRegistrationToken.cs +1667 -812
  92. package/Runtime/Core/MessageRegistrationToken.cs.meta +3 -3
  93. package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +9 -1
  94. package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +3 -3
  95. package/Runtime/Core/Messages/ITargetedMessage.cs.meta +3 -3
  96. package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +3 -3
  97. package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +9 -1
  98. package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +3 -3
  99. package/Runtime/Core/Messages/StringMessage.cs.meta +9 -1
  100. package/Runtime/Core/MessagingDebug.cs.meta +3 -3
  101. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +3 -3
  102. package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +3 -3
  103. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +3 -3
  104. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +9 -1
  105. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +3 -3
  106. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +9 -1
  107. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +3 -3
  108. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +9 -1
  109. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +3 -3
  110. package/Runtime/Unity/MessageAwareComponent.cs +46 -1
  111. package/Runtime/Unity/MessageAwareComponent.cs.meta +3 -3
  112. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +3 -3
  113. package/Runtime/Unity/MessagingComponent.cs +43 -10
  114. package/Runtime/Unity/MessagingComponent.cs.meta +3 -3
  115. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +3 -3
  116. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +3 -3
  117. package/Runtime/WallstopStudios.DxMessaging.asmdef +1 -1
  118. package/Samples~/DI/README.md +7 -7
  119. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +3 -3
  120. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +3 -3
  121. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +3 -3
  122. package/Samples~/Mini Combat/Boot.cs.meta +3 -3
  123. package/Samples~/Mini Combat/Enemy.cs.meta +3 -3
  124. package/Samples~/Mini Combat/Messages.cs.meta +3 -3
  125. package/Samples~/Mini Combat/Player.cs.meta +3 -3
  126. package/Samples~/Mini Combat/UIOverlay.cs.meta +3 -3
  127. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +3 -3
  128. package/Samples~/UI Buttons + Inspector/Messages.cs.meta +3 -3
  129. package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +3 -3
  130. package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +3 -3
  131. package/SourceGenerators/Directory.Build.props +50 -3
  132. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
  133. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +3 -3
  134. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
  135. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +9 -1
  136. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +40 -46
  137. package/SourceGenerators/global.json +7 -0
  138. package/SourceGenerators/global.json.meta +7 -0
  139. package/package.json +30 -40
  140. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  141. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +0 -33
  142. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  143. package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs +0 -51
  144. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  145. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.dll +0 -0
  146. /package/{Editor → Runtime}/Analyzers/System.Collections.Immutable.dll +0 -0
  147. /package/{Editor → Runtime}/Analyzers/System.Reflection.Metadata.dll +0 -0
  148. /package/{Editor → Runtime}/Analyzers/System.Runtime.CompilerServices.Unsafe.dll +0 -0
@@ -340,10 +340,11 @@ namespace DxMessaging.Editor.Analyzers
340
340
 
341
341
  LoadFromDisk();
342
342
 
343
- // AssetDatabase isn't fully ready inside the static ctor; defer the first scan one
344
- // editor tick so settings load doesn't fight a transitional asset-import state.
345
- EditorApplication.delayCall += SafeRescanFromCallback;
346
- AssemblyReloadEvents.afterAssemblyReload += SafeRescanFromCallback;
343
+ // AssetDatabase isn't fully ready inside the static ctor; defer the first scan
344
+ // until Unity is idle so settings load doesn't fight a transitional asset-import
345
+ // state.
346
+ ScheduleRescanWhenIdle();
347
+ AssemblyReloadEvents.afterAssemblyReload += ScheduleRescanWhenIdle;
347
348
  CompilationPipeline.assemblyCompilationFinished += OnAssemblyCompilationFinished;
348
349
  if (!_logEntriesDisabled)
349
350
  {
@@ -352,8 +353,9 @@ namespace DxMessaging.Editor.Analyzers
352
353
  }
353
354
  catch (Exception ex)
354
355
  {
355
- Debug.LogWarning(
356
- $"[DxMessaging] DxMessagingConsoleHarvester failed to initialize: {ex.Message}"
356
+ DxMessagingEditorLog.LogWarning(
357
+ "DxMessagingConsoleHarvester failed to initialize.",
358
+ ex
357
359
  );
358
360
  _logEntriesDisabled = true;
359
361
  IsAvailable = false;
@@ -428,7 +430,7 @@ namespace DxMessaging.Editor.Analyzers
428
430
  }
429
431
  catch (Exception ex)
430
432
  {
431
- LogOnce("scanner", $"BaseCallTypeScanner.Scan threw: {ex.Message}");
433
+ LogExceptionOnce("scanner", "BaseCallTypeScanner.Scan threw.", ex);
432
434
  scannerEntries = new Dictionary<string, BaseCallReportEntry>(
433
435
  StringComparer.Ordinal
434
436
  );
@@ -492,7 +494,7 @@ namespace DxMessaging.Editor.Analyzers
492
494
  }
493
495
  catch (Exception ex)
494
496
  {
495
- LogOnce("aggregate", $"Snapshot merge failed: {ex.Message}");
497
+ LogExceptionOnce("aggregate", "Snapshot merge failed.", ex);
496
498
  // Fall through with the scanner-only snapshot; partial data is better than
497
499
  // wiping the snapshot when the bridge half misbehaves.
498
500
  }
@@ -616,7 +618,7 @@ namespace DxMessaging.Editor.Analyzers
616
618
  }
617
619
  catch (Exception ex)
618
620
  {
619
- LogOnce("getcount", $"GetCount invocation failed: {ex.Message}");
621
+ LogExceptionOnce("getcount", "GetCount invocation failed.", ex);
620
622
  return new Dictionary<string, ParsedTypeReport>(StringComparer.Ordinal);
621
623
  }
622
624
 
@@ -633,7 +635,7 @@ namespace DxMessaging.Editor.Analyzers
633
635
  }
634
636
  catch (Exception ex)
635
637
  {
636
- LogOnce("start", $"StartGettingEntries invocation failed: {ex.Message}");
638
+ LogExceptionOnce("start", "StartGettingEntries invocation failed.", ex);
637
639
  return new Dictionary<string, ParsedTypeReport>(StringComparer.Ordinal);
638
640
  }
639
641
 
@@ -652,8 +654,13 @@ namespace DxMessaging.Editor.Analyzers
652
654
  {
653
655
  harvestedCount = (int)_getCount.Invoke(null, null);
654
656
  }
655
- catch
657
+ catch (Exception ex)
656
658
  {
659
+ LogExceptionOnce(
660
+ "getcount-after-start",
661
+ "GetCount after StartGettingEntries failed.",
662
+ ex
663
+ );
657
664
  // Retain the previous count.
658
665
  }
659
666
  }
@@ -670,9 +677,10 @@ namespace DxMessaging.Editor.Analyzers
670
677
  }
671
678
  catch (Exception ex)
672
679
  {
673
- LogOnce(
680
+ LogExceptionOnce(
674
681
  "getentry",
675
- $"GetEntryInternal invocation failed at index {j}: {ex.Message}"
682
+ $"GetEntryInternal invocation failed at index {j}.",
683
+ ex
676
684
  );
677
685
  continue;
678
686
  }
@@ -684,9 +692,10 @@ namespace DxMessaging.Editor.Analyzers
684
692
  }
685
693
  catch (Exception ex)
686
694
  {
687
- LogOnce(
695
+ LogExceptionOnce(
688
696
  "getmessage",
689
- $"LogEntry.message read failed at index {j}: {ex.Message}"
697
+ $"LogEntry.message read failed at index {j}.",
698
+ ex
690
699
  );
691
700
  continue;
692
701
  }
@@ -699,7 +708,7 @@ namespace DxMessaging.Editor.Analyzers
699
708
  }
700
709
  catch (Exception ex)
701
710
  {
702
- LogOnce("harvest", $"Harvest loop failed: {ex.Message}");
711
+ LogExceptionOnce("harvest", "Harvest loop failed.", ex);
703
712
  }
704
713
  finally
705
714
  {
@@ -709,7 +718,7 @@ namespace DxMessaging.Editor.Analyzers
709
718
  }
710
719
  catch (Exception ex)
711
720
  {
712
- LogOnce("end", $"EndGettingEntries invocation failed: {ex.Message}");
721
+ LogExceptionOnce("end", "EndGettingEntries invocation failed.", ex);
713
722
  }
714
723
  }
715
724
 
@@ -720,9 +729,10 @@ namespace DxMessaging.Editor.Analyzers
720
729
  }
721
730
  catch (Exception ex)
722
731
  {
723
- LogOnce(
732
+ LogExceptionOnce(
724
733
  "aggregate-logentries",
725
- $"Aggregating LogEntries lines failed: {ex.Message}"
734
+ "Aggregating LogEntries lines failed.",
735
+ ex
726
736
  );
727
737
  return new Dictionary<string, ParsedTypeReport>(StringComparer.Ordinal);
728
738
  }
@@ -770,11 +780,7 @@ namespace DxMessaging.Editor.Analyzers
770
780
  // LogEntries is unavailable, Tick is not registered, so we fall back to delayCall.
771
781
  if (_logEntriesDisabled)
772
782
  {
773
- if (!_rescanScheduled)
774
- {
775
- _rescanScheduled = true;
776
- EditorApplication.delayCall += DrainScheduledRescan;
777
- }
783
+ ScheduleRescanWhenIdle();
778
784
  return;
779
785
  }
780
786
  _lastSeenCount = -1;
@@ -816,7 +822,7 @@ namespace DxMessaging.Editor.Analyzers
816
822
  }
817
823
  catch (Exception ex)
818
824
  {
819
- LogOnce("tick-count", $"GetCount during Tick failed: {ex.Message}");
825
+ LogExceptionOnce("tick-count", "GetCount during Tick failed.", ex);
820
826
  return;
821
827
  }
822
828
 
@@ -827,7 +833,7 @@ namespace DxMessaging.Editor.Analyzers
827
833
  }
828
834
  catch (Exception ex)
829
835
  {
830
- LogOnce("tick", $"Tick failed: {ex.Message}");
836
+ LogExceptionOnce("tick", "Tick failed.", ex);
831
837
  }
832
838
  }
833
839
 
@@ -841,27 +847,13 @@ namespace DxMessaging.Editor.Analyzers
841
847
  // are still compiling; the compiler holds its log-buffer lock and our reflection
842
848
  // call blocks waiting for it. Combined with AssetDatabase touches inside RescanNow,
843
849
  // this caused permanent script-compilation freezes on Unity startup.
844
- //
845
- // S4: when the legacy console-bridge is OFF, we don't need to parse CompilerMessage
846
- // payloads at all; the IL-reflection scanner is the sole data source and it runs
847
- // off the AssemblyReloadEvents.afterAssemblyReload hook that fires once per build,
848
- // not per-assembly. Bail out early so a 30-assembly build doesn't burn CPU running
849
- // the regex-heavy parser 30 times for output we'll never read. Read the setting once
850
- // up-front so the gate decision is consistent for the whole callback (settings can
851
- // be edited concurrently by the Project Settings page on the main thread).
852
- DxMessagingSettings settingsForGate = TryLoadSettings();
853
- bool bridgeEnabled = settingsForGate != null && settingsForGate._useConsoleBridge;
854
- if (!bridgeEnabled)
855
- {
856
- return;
857
- }
858
-
859
850
  // We DO parse the per-assembly CompilerMessage payload here (cheap, pure-CPU work,
860
- // no AssetDatabase / LogEntries contact) and stash it in the cross-thread channel.
861
- // DrainScheduledRescan (on a delayCall) folds the channel into the live snapshot
862
- // once the compile burst is complete. This is the primary data path on Unity 2021,
863
- // where Roslyn-analyzer warnings DO arrive in CompilerMessage[] but do NOT reliably
864
- // appear in the LogEntries store.
851
+ // no AssetDatabase / LogEntries contact) and stash it in the cross-thread channel
852
+ // without checking settings here. The settings gate requires AssetDatabase access, so
853
+ // RescanNow applies it later after DrainScheduledRescan has requeued until Unity is
854
+ // idle; if the bridge is disabled, RescanNow clears this pending buffer. This is the
855
+ // primary bridge data path on Unity 2021, where Roslyn-analyzer warnings DO arrive in
856
+ // CompilerMessage[] but do NOT reliably appear in the LogEntries store.
865
857
  try
866
858
  {
867
859
  if (!string.IsNullOrEmpty(assemblyPath) && messages != null)
@@ -899,17 +891,21 @@ namespace DxMessaging.Editor.Analyzers
899
891
  }
900
892
  catch (Exception ex)
901
893
  {
902
- LogOnce(
894
+ LogExceptionOnce(
903
895
  "compilation-parse",
904
- $"Failed to parse CompilerMessage payload for {assemblyPath}: {ex.Message}"
896
+ $"Failed to parse CompilerMessage payload for {assemblyPath}.",
897
+ ex
905
898
  );
906
899
  }
907
900
 
908
- // Fix: schedule a single delayCall. delayCall fires AFTER the current event chain
909
- // unwinds and AFTER `EditorApplication.isCompiling` flips back to false. Multiple
910
- // delayCall registrations from the same compile burst are debounced by the
911
- // _rescanScheduled latch; only one deferred RescanNow runs per build.
912
- if (_rescanScheduled)
901
+ // Schedule a single delayed drain. The callback rechecks editor state and requeues if
902
+ // Unity is still compiling/updating, so this never drops the final rescan.
903
+ ScheduleRescanWhenIdle();
904
+ }
905
+
906
+ internal static void ScheduleRescanWhenIdle()
907
+ {
908
+ if (!IsAvailable || _rescanScheduled)
913
909
  {
914
910
  return;
915
911
  }
@@ -942,7 +938,7 @@ namespace DxMessaging.Editor.Analyzers
942
938
  }
943
939
  catch (Exception ex)
944
940
  {
945
- LogOnce("rescan-callback", $"RescanNow callback threw: {ex.Message}");
941
+ LogExceptionOnce("rescan-callback", "RescanNow callback threw.", ex);
946
942
  }
947
943
  }
948
944
 
@@ -971,7 +967,7 @@ namespace DxMessaging.Editor.Analyzers
971
967
  }
972
968
  catch (Exception ex)
973
969
  {
974
- LogOnce("settings", $"Could not load DxMessagingSettings: {ex.Message}");
970
+ LogExceptionOnce("settings", "Could not load DxMessagingSettings.", ex);
975
971
  return null;
976
972
  }
977
973
  }
@@ -984,9 +980,10 @@ namespace DxMessaging.Editor.Analyzers
984
980
  }
985
981
  catch (Exception ex)
986
982
  {
987
- LogOnce(
983
+ LogExceptionOnce(
988
984
  $"resolve-{name}",
989
- $"Failed to resolve static method '{name}' on {type.FullName}: {ex.Message}"
985
+ $"Failed to resolve static method '{name}' on {type.FullName}.",
986
+ ex
990
987
  );
991
988
  return null;
992
989
  }
@@ -1000,9 +997,10 @@ namespace DxMessaging.Editor.Analyzers
1000
997
  }
1001
998
  catch (Exception ex)
1002
999
  {
1003
- LogOnce(
1000
+ LogExceptionOnce(
1004
1001
  $"resolve-field-{name}",
1005
- $"Failed to resolve instance field '{name}' on {type.FullName}: {ex.Message}"
1002
+ $"Failed to resolve instance field '{name}' on {type.FullName}.",
1003
+ ex
1006
1004
  );
1007
1005
  return null;
1008
1006
  }
@@ -1017,6 +1015,15 @@ namespace DxMessaging.Editor.Analyzers
1017
1015
  Debug.LogWarning($"[DxMessaging] {message}");
1018
1016
  }
1019
1017
 
1018
+ private static void LogExceptionOnce(string key, string message, Exception exception)
1019
+ {
1020
+ if (!AlreadyWarned.Add(key))
1021
+ {
1022
+ return;
1023
+ }
1024
+ DxMessagingEditorLog.LogWarning(message, exception);
1025
+ }
1026
+
1020
1027
  private static void RaiseReportUpdated()
1021
1028
  {
1022
1029
  try
@@ -1025,7 +1032,7 @@ namespace DxMessaging.Editor.Analyzers
1025
1032
  }
1026
1033
  catch (Exception ex)
1027
1034
  {
1028
- Debug.LogWarning($"[DxMessaging] ReportUpdated subscriber threw: {ex.Message}");
1035
+ LogExceptionOnce("report-updated", "ReportUpdated subscriber threw.", ex);
1029
1036
  }
1030
1037
  }
1031
1038
 
@@ -1057,7 +1064,7 @@ namespace DxMessaging.Editor.Analyzers
1057
1064
  }
1058
1065
  catch (Exception ex)
1059
1066
  {
1060
- LogOnce("persist", $"Failed to persist analyzer diagnostics report: {ex.Message}");
1067
+ LogExceptionOnce("persist", "Failed to persist analyzer diagnostics report.", ex);
1061
1068
  }
1062
1069
  }
1063
1070
 
@@ -1097,7 +1104,7 @@ namespace DxMessaging.Editor.Analyzers
1097
1104
  }
1098
1105
  catch (Exception ex)
1099
1106
  {
1100
- LogOnce("load", $"Failed to load analyzer diagnostics report: {ex.Message}");
1107
+ LogExceptionOnce("load", "Failed to load analyzer diagnostics report.", ex);
1101
1108
  }
1102
1109
  }
1103
1110
 
@@ -6,6 +6,6 @@ MonoImporter:
6
6
  defaultReferences: []
7
7
  executionOrder: 0
8
8
  icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
2
  guid: 55bb3ae7ef064633b5fe4b17ce29f8cc
3
- timeCreated: 1761880591
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -6,6 +6,6 @@ MonoImporter:
6
6
  defaultReferences: []
7
7
  executionOrder: 0
8
8
  icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -76,8 +76,9 @@ namespace DxMessaging.Editor.CustomEditors
76
76
  }
77
77
  catch (System.Exception ex)
78
78
  {
79
- Debug.LogWarning(
80
- $"[DxMessaging] Failed to repaint inspectors after analyzer report update: {ex.Message}"
79
+ DxMessagingEditorLog.LogWarning(
80
+ "Failed to repaint inspectors after analyzer report update.",
81
+ ex
81
82
  );
82
83
  }
83
84
  }
@@ -130,7 +131,7 @@ namespace DxMessaging.Editor.CustomEditors
130
131
  {
131
132
  return;
132
133
  }
133
- int instanceId = messageAwareComponent.GetInstanceID();
134
+ int instanceId = DxMessaging.Core.InstanceId.StableId(messageAwareComponent);
134
135
  if (!_renderedThisRepaint.Add(instanceId))
135
136
  {
136
137
  return;
@@ -183,9 +184,7 @@ namespace DxMessaging.Editor.CustomEditors
183
184
  }
184
185
  catch (System.Exception ex)
185
186
  {
186
- Debug.LogWarning(
187
- $"[DxMessaging] Inspector overlay could not load settings: {ex.Message}"
188
- );
187
+ DxMessagingEditorLog.LogWarning("Inspector overlay could not load settings.", ex);
189
188
  return false;
190
189
  }
191
190
 
@@ -369,7 +368,7 @@ namespace DxMessaging.Editor.CustomEditors
369
368
  }
370
369
  catch (System.Exception ex)
371
370
  {
372
- Debug.LogWarning($"[DxMessaging] Failed to open script: {ex.Message}");
371
+ DxMessagingEditorLog.LogWarning("Failed to open script.", ex);
373
372
  }
374
373
  }
375
374
 
@@ -381,19 +380,24 @@ namespace DxMessaging.Editor.CustomEditors
381
380
  // frame, corrupting Unity's per-window layout cache. delayCall fires AFTER the
382
381
  // current GUI cycle, so the next frame's Layout pass sees the new state and
383
382
  // both passes emit consistent control counts.
384
- EditorApplication.delayCall += () =>
383
+ DxMessagingEditorIdle.ScheduleAssetDatabaseMutation(() =>
385
384
  {
385
+ if (settings == null)
386
+ {
387
+ return;
388
+ }
386
389
  try
387
390
  {
388
391
  settings.AddIgnoredType(fullName);
389
392
  }
390
393
  catch (System.Exception ex)
391
394
  {
392
- Debug.LogWarning(
393
- $"[DxMessaging] Failed to add ignored type '{fullName}': {ex.Message}"
395
+ DxMessagingEditorLog.LogWarning(
396
+ $"Failed to add ignored type '{fullName}'.",
397
+ ex
394
398
  );
395
399
  }
396
- };
400
+ });
397
401
  }
398
402
 
399
403
  private static void TryRemoveIgnoredType(DxMessagingSettings settings, string fullName)
@@ -401,19 +405,24 @@ namespace DxMessaging.Editor.CustomEditors
401
405
  // Same reasoning as TryAddIgnoredType: defer mutation past the current GUI cycle so
402
406
  // the overlay's shape gating remains identical on Layout and Repaint passes of THIS
403
407
  // frame. The next frame's Layout pass observes the new state; both passes agree.
404
- EditorApplication.delayCall += () =>
408
+ DxMessagingEditorIdle.ScheduleAssetDatabaseMutation(() =>
405
409
  {
410
+ if (settings == null)
411
+ {
412
+ return;
413
+ }
406
414
  try
407
415
  {
408
416
  settings.RemoveIgnoredType(fullName);
409
417
  }
410
418
  catch (System.Exception ex)
411
419
  {
412
- Debug.LogWarning(
413
- $"[DxMessaging] Failed to remove ignored type '{fullName}': {ex.Message}"
420
+ DxMessagingEditorLog.LogWarning(
421
+ $"Failed to remove ignored type '{fullName}'.",
422
+ ex
414
423
  );
415
424
  }
416
- };
425
+ });
417
426
  }
418
427
  }
419
428
  #endif
@@ -6,6 +6,6 @@ MonoImporter:
6
6
  defaultReferences: []
7
7
  executionOrder: 0
8
8
  icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
2
  guid: e078b310572343318b79a3c00d0f274d
3
- timeCreated: 1749666380
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,62 @@
1
+ namespace DxMessaging.Editor
2
+ {
3
+ #if UNITY_EDITOR
4
+ using System;
5
+ using UnityEditor;
6
+
7
+ /// <summary>
8
+ /// Shared guard for editor callbacks that mutate Unity's AssetDatabase.
9
+ /// </summary>
10
+ internal static class DxMessagingEditorIdle
11
+ {
12
+ internal static bool CanMutateAssetDatabase()
13
+ {
14
+ return !EditorApplication.isUpdating && !EditorApplication.isCompiling;
15
+ }
16
+
17
+ internal static void ScheduleAssetDatabaseMutation(Action work)
18
+ {
19
+ ScheduleAssetDatabaseMutation(work, ScheduleDelayCall, CanMutateAssetDatabase);
20
+ }
21
+
22
+ internal static void ScheduleAssetDatabaseMutation(
23
+ Action work,
24
+ Action<Action> scheduler,
25
+ Func<bool> canMutateAssetDatabase
26
+ )
27
+ {
28
+ if (work == null)
29
+ {
30
+ return;
31
+ }
32
+
33
+ Action<Action> effectiveScheduler = scheduler ?? ScheduleDelayCall;
34
+ Func<bool> effectiveCanMutate = canMutateAssetDatabase ?? CanMutateAssetDatabase;
35
+
36
+ effectiveScheduler(() =>
37
+ RunAssetDatabaseMutationWhenIdle(work, effectiveScheduler, effectiveCanMutate)
38
+ );
39
+ }
40
+
41
+ private static void RunAssetDatabaseMutationWhenIdle(
42
+ Action work,
43
+ Action<Action> scheduler,
44
+ Func<bool> canMutateAssetDatabase
45
+ )
46
+ {
47
+ if (!canMutateAssetDatabase())
48
+ {
49
+ ScheduleAssetDatabaseMutation(work, scheduler, canMutateAssetDatabase);
50
+ return;
51
+ }
52
+
53
+ work();
54
+ }
55
+
56
+ private static void ScheduleDelayCall(Action work)
57
+ {
58
+ EditorApplication.delayCall += () => work();
59
+ }
60
+ }
61
+ #endif
62
+ }
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 031ffa9bfbf249728da382bb9e03b017
2
+ guid: 6f73f10f1fd14bb6bc417bc2e23f425d
3
3
  MonoImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2