Skip to content

Releases: PaulNonatomic/ServiceKit

2.2.0

18 Nov 08:12

Choose a tag to compare

[2.2.0] - 2025-11-17

Improved

  • Editor Menu Cleanup: Streamlined Tools > ServiceKit menu from 10 to 6 essential items

    • Removed duplicate "Auto-Assign All ServiceKit Locators" wrapper
    • Removed duplicate "Project Settings" entry
    • Removed testing utility "Clear ServiceKit Window Selection"
    • Removed debug utility "Debug ServiceKitLocator Discovery"
  • Enhanced User Experience: Added informative confirmation dialogs to menu items

    • "Auto-Assign ServiceKit Locators" now shows asset count and default locator before proceeding
    • "Process All Auto-Assignments" explains when to use and common scenarios
    • "Validate Configuration" describes what will be checked and shows completion summary

Documentation

  • Addressables Integration Guide: Added comprehensive documentation for using ServiceKit with Unity Addressables
    • Explains how to make ServiceKitLocator addressable
    • Documents critical ScriptableObject instance behavior in addressable scenes
    • Provides recommendations for when to use addressable vs non-addressable ServiceKitLocators
    • Includes practical code examples for bootstrapping with addressable locators
    • Added service lifecycle section explaining automatic cleanup and persistence options (DontDestroyOnLoad, additive loading)

[2.1.11] - 2025-11-17

Fixed

  • Service Injection During Cancellation: Fixed bug where resolved services were not injected when cancellation occurred
    • Previously, TryInjectResolvedServices was only called when ShouldIgnoreCancellation returned true
    • Now always attempts to inject successfully resolved services before returning or throwing
    • Ensures dependencies are injected even when explicit cancellation tokens are cancelled during resolution

Changed

  • ServiceKitLocator Visibility: Changed ServiceKitLocator field from protected to public in ServiceKitBehaviour
    • Enables better test scenarios and external access when needed
    • Non-breaking change that maintains backward compatibility

[2.1.10] - 2025-10-11

  • Fix for maintaining foldout state in ServiceKitWindow

[2.1.9] - 2025-10-11

  • Fix for services registered in addressable scenes being listed under DoNotDestroy in the ServiceKit Window

[2.1.8] - 2025-10-06

[2.1.7] - 2025-10-06

  • Added an early return to ServiceKitBehaviour.IsServiceLocatorMissing when the application is quitting

[2.1.6] - 2025-09-15

  • Deleted a test with an invalid meta file

2.1.5

11 Sep 20:11
890f13c

Choose a tag to compare

[2.1.5] - 2025-09-10
Fixed
TOCTOU Race Condition in Optional Dependencies: Fixed critical race condition in optional dependency resolution

Previously used separate IsServiceReady() and GetService() calls which weren't atomic
Service could be unregistered between the check and get operations (e.g., during scene unload)
This caused InitializeService to be called with null optional dependencies despite services being ready
Fixed by using atomic TryGetService() operation that checks and gets under a single lock
Eliminates race condition where ServiceB's InitializeService could be called with null ServiceA
Services Not Injected on Ignored Cancellation: Fixed critical bug where resolved services were not injected when cancellation was ignored

When application quits or ShouldIgnoreCancellation returns true, ExecuteAsync would return early without injecting already-resolved services
This caused InitializeService to be called with null dependencies even though services were successfully resolved
Fixed by ensuring resolved services are always injected before returning, even when cancellation is ignored
Awake Order Race Condition for Optional Dependencies: Fixed race condition where optional dependencies were incorrectly treated as absent

When ServiceA with optional dependency on ServiceB had its Awake() called before ServiceB's Awake(), ServiceB would be null
This occurred because Unity's Awake order is non-deterministic within a scene
ServiceA would check for ServiceB before ServiceB had a chance to register itself
Fixed by adding a one-frame delay when optional dependencies are not registered, allowing all services in the scene to complete their

Awake phase
Now correctly distinguishes between "not registered yet" and "truly absent" optional dependencies

Improved
Code Quality: Enhanced code standards and self-documentation
Renamed methods for clarity (e.g., WaitForAwakePhaseCompletion)
Removed redundant comments and debug logging
Extracted complex logic into well-named helper methods
Improved overall code maintainability and readability

[2.1.3] - 2025-09-09
Fixed
Optional Dependency Race Condition: Fixed critical bug in optional dependency resolution
Optional dependencies marked with Required = false that were registered but not ready now correctly wait for the service
Previously, multiple waiters for the same service could interfere with each other's cancellation tokens
Fixed by implementing per-caller TaskCompletionSource to isolate cancellation behavior
This ensures the documented 3-state intelligent resolution works correctly:
Service ready → inject immediately
Service registered but not ready → wait for it (treat as temporarily required)
Service not registered → skip injection (field remains null)

Improved
Code Quality: Enhanced ServiceInjectionBuilder for better maintainability
Extracted timeout exception building into well-named helper methods
Improved self-documentation with clear method names
Added explicit comments explaining optional dependency behavior
Removed debug logging and simplified async service resolution

[2.1.2] - 2025-09-02
[2.1.1] - 2025-09-02
Removed performance tests as they had corrupted meta files

[2.1.0] - 2025-09-02
Added
Memory Performance Optimizations: Comprehensive memory allocation improvements

Added ServiceKitObjectPool for object pooling of Lists and StringBuilders
Eliminated LINQ allocations in hot paths (GetAllServices, GetServicesWithTag, etc.)
Replaced string concatenation with pooled StringBuilder usage
Added pre-allocated lists for batch operations in TimeoutManager
Zero-allocation service resolution for cached services
Memory Performance Tests: New comprehensive test suite for memory profiling

MemoryAllocationTracker utility for precise allocation measurement
ServiceKitMemoryPerformanceTests for core operation allocation testing
LinqVsOptimizedComparisonTests comparing LINQ vs optimized implementations
ServiceKitMemoryBenchmarkRunner for automated benchmark execution with CSV export

Fixed
Runtime Exit Errors: Fixed ServiceKitTimeoutManager cleanup issues
Resolved "objects were not cleaned up" warning when exiting Play Mode
Fixed timeout exceptions being thrown during application quit
Added proper cleanup in OnDestroy, OnApplicationQuit, and editor mode transitions
Enhanced ServiceKitPlayModeHandler to properly clean up on exit

Improved
Code Standards: Enhanced self-documenting code throughout

Refactored ServiceKitTimeoutManager with descriptive method names
Improved ServiceKitBehaviour with better encapsulation
Enhanced ServiceKitObjectPool with generic helper methods
Consistent preprocessor directive formatting (no indentation)
Better separation of concerns with extracted helper methods
Performance: Significant reduction in runtime allocations

GetService: Now allocation-free for cached services
IsServiceReady: Zero allocations
GetAllServices: Reduced allocations by ~70% through pooling
String operations: 90% reduction through StringBuilder pooling

[2.0.0] - 2025-09-01
Breaking Changes
ServiceKitBehaviour API Changes: Renamed methods and fields for improved self-documenting code

Protected Fields:
Registered → IsServiceRegistered
Ready → IsServiceReady

Protected Methods:
RegisterService() → RegisterServiceWithLocator()
UnregisterService() → UnregisterServiceFromLocator()
InjectServicesAsync() → InjectDependenciesAsync()
MarkServiceReady() → MarkServiceAsReady()
OnServiceInjectionFailed() → HandleDependencyInjectionFailure()

Improved
Code Quality: Major refactoring for self-documenting code
All method names now clearly express their intent
Improved variable naming throughout the codebase
Extracted helper methods for better separation of concerns
Enhanced readability following Microsoft C# coding guidelines
Simplified cancellation token handling using Unity's built-in destroyCancellationToken

Migration Guide
See the README.md for detailed migration instructions from v1.x to v2.0

[1.4.3] - Aug 29, 2025
Fixed
Edit Mode Test Compatibility: Fixed DontDestroyOnLoad error in ServiceKitTimeoutManager during Edit Mode tests
Added conditional compilation to only call DontDestroyOnLoad in Play Mode
Ensures ServiceKitTimeoutManager works correctly in Edit Mode tests, Play Mode, and built applications

Added
Test Coverage: Added comprehensive test for InitializeService timing with optional dependencies
Verifies that InitializeService waits for all registered dependencies (even optional ones) to become ready
Confirms 3-state dependency resolution behavior is working as designed

1.4.2

29 Aug 16:16

Choose a tag to compare

[1.4.2] - Aug 29, 2025

Fixed

  • Compilation Error: Fixed CS0246 error in ServiceKitThreading.cs when SERVICEKIT_UNITASK is not defined
    • Added conditional using statements to properly import System.Threading.Tasks namespace
    • Ensures Task type is available in both UniTask and standard .NET Task scenarios

1.4.1

29 Aug 16:10

Choose a tag to compare

[1.4.1] - Aug 29, 2025

Improved

  • Code Quality: Comprehensive coding standards review and refactoring
    • Applied "never nesting" principle - eliminated all nested if statements with early returns and guard clauses
    • Enhanced self-documenting code with clear, action-oriented method names
    • Applied SOLID principles with improved Single Responsibility adherence
    • Better separation of concerns in ServiceInjectionBuilder, ServiceKitLocator, and ServiceKitBehaviour
    • Improved method names and variable naming for better code readability
    • No functional changes - purely internal code quality improvements

[1.4.0] - Aug 29, 2025

Added

  • Intelligent 3-State Dependency Resolution: Enhanced InjectService attribute with smart behavior when Required = false
    • Service is ready → Inject immediately
    • Service is registered but not ready → Wait for it (treat as required temporarily)
    • Service is not registered → Skip injection (field remains null)
  • Comprehensive test coverage for all three dependency resolution states
  • Mixed scenario testing for complex dependency graphs

Changed

  • BREAKING CHANGE: Enhanced Required = false behavior - now uses intelligent resolution instead of simple ready-check
  • Updated InjectServiceAttribute documentation to reflect new 3-state behavior
  • Updated README.md with detailed explanation of intelligent dependency resolution

Improved

  • Eliminates guesswork in optional dependency management
  • More predictable behavior for developers
  • Better handling of services that are "coming soon" vs "never coming"
  • Maintains backward compatibility for Required = true (default behavior unchanged)

[1.3.3] - Aug 12, 2025

  • Improved error handling for service registration failures
  • Enhanced null service detection to identify missing interface implementations
  • Added detailed error messages showing which interfaces a ServiceKitBehaviour failed to implement
  • ServiceKitBehaviour now provides proactive error checking before attempting registration

[1.3.2] - Aug 12, 2025

  • Hotfix added the ExecuteWithCancellationAsync method to the IServiceInjectionBuilder

[1.3.1] - Aug 12, 2025

  • hotfix to remove the hidden tools directory. The content has been moved to it's own repo for ServiceKit Roslyn Analyzers
  • updated the path to retrieve the Roslyn Analyzers dll to always pull the latest.

[1.3.0] - Aug 12, 2025

  • Abstracted some functionality out of the ServiceInjectionBuilder as it was bloated
  • Added a convieniance method to execute and cancel a services injection request.

[1.2.2] - Aug 10, 2025

  • Updated package path in README

[1.2.1] - Aug 04, 2025

  • Hotfix for race condition in ServiceKitTimeoutManager
  • Added tests for race condition

1.2.1

11 Aug 22:56

Choose a tag to compare

1.2.1