From 336b2480f88e6d3c05023e63d3b23cd09ce3bdca Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Fri, 22 Mar 2024 12:21:21 +0200 Subject: [PATCH 1/7] Fix spelling: bsonSerializerShortcuts --- .../ConfigSection/ConfigSectionExtensionMethods.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs b/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs index 326fb89..a24cd3c 100644 --- a/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs +++ b/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs @@ -169,7 +169,7 @@ private static ISerializerAdapter CreateSerializerAdapterFromConfigName(string s "binaryserializer" }; - var bsonSerializerShortcusts = + var bsonSerializerShortcuts = new[] { "bson", @@ -180,7 +180,7 @@ private static ISerializerAdapter CreateSerializerAdapterFromConfigName(string s if (binarySerializerShortcuts.Contains(serializerName.ToLower())) return new BinarySerializerAdapter(); - if (bsonSerializerShortcusts.Contains(serializerName.ToLower())) + if (bsonSerializerShortcuts.Contains(serializerName.ToLower())) return new BsonSerializerAdapter(); var serializerAdapterType = GetTypeFromConfigString(serializerName); From 06073754f2359b2289fe89cb164f99cb5363c200 Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Fri, 22 Mar 2024 12:24:41 +0200 Subject: [PATCH 2/7] Change default serializer to BSON to align with non-classic API's default --- .../ConfigSection/ServerInstanceConfigElement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs b/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs index c817ebb..edcb911 100644 --- a/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs +++ b/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs @@ -51,7 +51,7 @@ public int KeySize /// /// Gets or sets the name of the serializer which should be used by the server instance. /// - [ConfigurationProperty("serializer", IsRequired = false, DefaultValue = "binary")] + [ConfigurationProperty("serializer", IsRequired = false, DefaultValue = "bson")] public string Serializer { get => (string)base["serializer"]; From f5985c42dc147da10e1e201a4176a83b6dc81bf6 Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Fri, 22 Mar 2024 12:25:15 +0200 Subject: [PATCH 3/7] Change default channel to TCP to align with non-classic API's default --- .../ConfigSection/ServerInstanceConfigElement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs b/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs index edcb911..100f678 100644 --- a/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs +++ b/CoreRemoting/ClassicRemotingApi/ConfigSection/ServerInstanceConfigElement.cs @@ -61,7 +61,7 @@ public string Serializer /// /// Gets or sets the type of the server channel which should be used for communication. /// - [ConfigurationProperty("channel", IsRequired = false, DefaultValue = "ws")] + [ConfigurationProperty("channel", IsRequired = false, DefaultValue = "tcp")] public string Channel { get => (string)base["channel"]; From 495c7aaf4d678248ba69e4342e60b55d2427f758 Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Fri, 22 Mar 2024 12:28:24 +0200 Subject: [PATCH 4/7] Implement TCP channel recognition from Classic Remoting API configuration --- .../ConfigSectionExtensionMethods.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs b/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs index a24cd3c..64527be 100644 --- a/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs +++ b/CoreRemoting/ClassicRemotingApi/ConfigSection/ConfigSectionExtensionMethods.cs @@ -3,6 +3,7 @@ using System.Reflection; using CoreRemoting.Authentication; using CoreRemoting.Channels; +using CoreRemoting.Channels.Tcp; using CoreRemoting.Channels.Websocket; using CoreRemoting.Serialization; using CoreRemoting.Serialization.Binary; @@ -128,9 +129,15 @@ private static IServerChannel CreateServerChannelFromConfigName(string channelTy var websocketServerChannelShortcuts = new[] {"ws", "websocket"}; + var tcpServerChannelShortcuts = + new[] {"ws", "websocket"}; + if (websocketServerChannelShortcuts.Contains(channelTypeName.ToLower())) return new WebsocketServerChannel(); + if (tcpServerChannelShortcuts.Contains(channelTypeName.ToLower())) + return new TcpServerChannel(); + var channelType = GetTypeFromConfigString(channelTypeName); return (IServerChannel) Activator.CreateInstance(channelType); @@ -143,12 +150,18 @@ private static IServerChannel CreateServerChannelFromConfigName(string channelTy /// Client channel private static IClientChannel CreateClientChannelFromConfigName(string channelTypeName) { - var websocketServerChannelShortcuts = + var websocketClientChannelShortcuts = new[] {"ws", "websocket"}; - if (websocketServerChannelShortcuts.Contains(channelTypeName.ToLower())) + var tcpClientChannelShortcuts = + new[] {"tcp"}; + + if (websocketClientChannelShortcuts.Contains(channelTypeName.ToLower())) return new WebsocketClientChannel(); + if (tcpClientChannelShortcuts.Contains(channelTypeName.ToLower())) + return new TcpClientChannel(); + var channelType = GetTypeFromConfigString(channelTypeName); return (IClientChannel) Activator.CreateInstance(channelType); From 6b278372ec02940e8d8b7a26a26caf8c0e00482d Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Sat, 23 Mar 2024 13:36:45 +0200 Subject: [PATCH 5/7] Fix spelling of 'remotely' --- CoreRemoting.Tests/RpcTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreRemoting.Tests/RpcTests.cs b/CoreRemoting.Tests/RpcTests.cs index 47bc59b..6bc0855 100644 --- a/CoreRemoting.Tests/RpcTests.cs +++ b/CoreRemoting.Tests/RpcTests.cs @@ -205,7 +205,7 @@ void ClientAction() } [Fact] - public void Events_should_work_remotly() + public void Events_should_work_remotely() { bool serviceEventCalled = false; bool customDelegateEventCalled = false; From b6889861ffdd506d4f990807fa0a92cb900ce6eb Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Sat, 23 Mar 2024 14:10:43 +0200 Subject: [PATCH 6/7] Fix spelling of 'stateSnapshot' --- CoreRemoting/CallContext.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CoreRemoting/CallContext.cs b/CoreRemoting/CallContext.cs index ee3f3d8..02350c3 100644 --- a/CoreRemoting/CallContext.cs +++ b/CoreRemoting/CallContext.cs @@ -35,12 +35,12 @@ public static object GetData(string name) => /// Array of call context entries public static CallContextEntry[] GetSnapshot() { - var stateSnaphsot = State.ToArray(); - var result = new CallContextEntry[stateSnaphsot.Length]; + var stateSnapshot = State.ToArray(); + var result = new CallContextEntry[stateSnapshot.Length]; - for(int i = 0; i< stateSnaphsot.Length; i++) + for(int i = 0; i< stateSnapshot.Length; i++) { - var entry = stateSnaphsot[i]; + var entry = stateSnapshot[i]; result[i] = new CallContextEntry() From 1fcd5e352ba023f866f84ecc49ba0b673fd31dc8 Mon Sep 17 00:00:00 2001 From: Francois Botha Date: Mon, 25 Mar 2024 09:58:32 +0200 Subject: [PATCH 7/7] Fix spelling: replacementAssembly --- .../Serialization/CrossFrameworkSerialization.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CoreRemoting/Serialization/CrossFrameworkSerialization.cs b/CoreRemoting/Serialization/CrossFrameworkSerialization.cs index 0d9c2f4..ba0c805 100644 --- a/CoreRemoting/Serialization/CrossFrameworkSerialization.cs +++ b/CoreRemoting/Serialization/CrossFrameworkSerialization.cs @@ -12,19 +12,19 @@ public static class CrossFrameworkSerialization /// Redirects all loading attempts from a specified assembly name to another assembly name. /// /// Name of the assembly that should be redirected - /// Name of the assembly that should be used as replacement - public static void RedirectAssembly(string assemblyShortName, string replacmentAssemblyShortName) + /// Name of the assembly that should be used as replacement + public static void RedirectAssembly(string assemblyShortName, string replacementAssemblyShortName) { Assembly HandleAssemblyResolve(object _, ResolveEventArgs args) { var requestedAssembly = new AssemblyName(args.Name); - + if (requestedAssembly.Name == assemblyShortName) { try { - var replacmentAssembly = Assembly.Load(replacmentAssemblyShortName); - return replacmentAssembly; + var replacementAssembly = Assembly.Load(replacementAssemblyShortName); + return replacementAssembly; } catch (Exception) { @@ -45,7 +45,7 @@ public static void RedirectPrivateCoreLibToMscorlib() { RedirectAssembly("System.Private.CoreLib", "mscorlib"); } - + /// /// Redirects assembly "mscorlib" to "System.Private.CoreLib". /// @@ -53,4 +53,4 @@ public static void RedirectMscorlibToPrivateCoreLib() { RedirectAssembly("mscorlib", "System.Private.CoreLib"); } -} \ No newline at end of file +}