fix: remove empty Dispose and fix nullability annotation#4920
Conversation
9377f63 to
5b87d6f
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Both changes are well-scoped and correct:
|
5b87d6f to
f0026fa
Compare
Remove unnecessary IDisposable implementation from EventReceiverOrchestrator since the Dispose method was empty (the underlying registry no longer uses ReaderWriterLockSlim). The service provider skips non-IDisposable services automatically. Add nullable annotation to the `instance` parameter in PropertyInjector.InjectPropertiesRecursiveAsync, since the method handles null by returning early (correct for recursive traversal of nested objects).
f0026fa to
be62d46
Compare
Summary
Closes #4858
IDisposableimplementation fromEventReceiverOrchestrator: TheDispose()method was empty (the underlyingEventReceiverRegistryno longer usesReaderWriterLockSlim). No callers explicitly callDispose()on this type -- it was only invoked byTUnitServiceProvider.DisposeAsync()which iterates registered services and disposes any that implementIDisposable. Removing the interface means the service provider simply skips it during cleanup.PropertyInjector.InjectPropertiesRecursiveAsync: Theinstanceparameter was typed as non-nullableobjectbut had a null guard that returned early. This is correct behavior for a recursive method (nested property values can be null), so the parameter is now annotated asobject?to match the actual contract.Test plan
dotnet build TUnit.Engine/TUnit.Engine.csprojsucceeds with 0 warnings and 0 errors across all target frameworks (netstandard2.0, net8.0, net9.0, net10.0)