From 07d5a6f86601cbb7c76b2f18503103b3b232aede Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Sat, 26 Aug 2023 00:02:17 -0700 Subject: [PATCH] ActivatorUtilities.CreateInstance => Activator.CreateInstance in some cases --- src/SuperSocket.Command/CommandMiddleware.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SuperSocket.Command/CommandMiddleware.cs b/src/SuperSocket.Command/CommandMiddleware.cs index d22ea7e32..27e4b08f5 100644 --- a/src/SuperSocket.Command/CommandMiddleware.cs +++ b/src/SuperSocket.Command/CommandMiddleware.cs @@ -178,12 +178,12 @@ private void RegisterCommandSetFactoriesFromServices(List co if (commandWrapFactory != null) { var commandWrapType = commandWrapFactory(command.GetType()); - cmd = ActivatorUtilities.CreateInstance(null, commandWrapType, command) as ICommand; + cmd = Activator.CreateInstance(commandWrapType, command) as ICommand; } var commandTypeInfo = new CommandTypeInfo(cmd); commandTypeInfo.ActualCommandType = actualCommandType; - commandSetFactories.Add(ActivatorUtilities.CreateInstance(null, commandSetFactoryType, commandTypeInfo) as ICommandSetFactory); + commandSetFactories.Add(Activator.CreateInstance(commandSetFactoryType, commandTypeInfo) as ICommandSetFactory); } } @@ -256,7 +256,7 @@ public ICommandSetFactory CreateCommandSetFactory(Type type) { var commandTyeInfo = new CommandTypeInfo(WrapRequired ? WrapFactory(type) : type, null); commandTyeInfo.ActualCommandType = type; - return ActivatorUtilities.CreateInstance(null, this.CommandSetFactoryType, commandTyeInfo) as ICommandSetFactory; + return Activator.CreateInstance(this.CommandSetFactoryType, commandTyeInfo) as ICommandSetFactory; } }