From 376aaae6e6d37ba88f159981b02087b2efff4b8e Mon Sep 17 00:00:00 2001 From: osexpert <33638596+osexpert@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:42:44 +0200 Subject: [PATCH] 0.0.2 --- Directory.Build.props | 2 +- Directory.Packages.props | 6 +- ...oting.Serialization.BinaryFormatter.csproj | 2 +- .../GoreRemoting.Serialization.Json.csproj | 5 +- .../JsonAdapter.cs | 4 ++ ...eRemoting.Serialization.MessagePack.csproj | 2 +- ...GoreRemoting.Serialization.Protobuf.csproj | 2 +- TODO.txt | 56 ------------------- global.json | 2 +- nuget push.bat | 5 +- 10 files changed, 18 insertions(+), 68 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f8fd57e..524e470 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,7 +20,7 @@ MIT osexpert - 0.0.1 + 0.0.2 remoting rpc grpc dotnet-remoting GRPC Remoting library for .NET Core and .NET Framework diff --git a/Directory.Packages.props b/Directory.Packages.props index 01139f4..c00b365 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,6 +23,7 @@ + @@ -35,8 +36,7 @@ - + - - \ No newline at end of file + diff --git a/GoreRemoting.Serialization.BinaryFormatter/GoreRemoting.Serialization.BinaryFormatter.csproj b/GoreRemoting.Serialization.BinaryFormatter/GoreRemoting.Serialization.BinaryFormatter.csproj index 2fa8ed3..de26b01 100644 --- a/GoreRemoting.Serialization.BinaryFormatter/GoreRemoting.Serialization.BinaryFormatter.csproj +++ b/GoreRemoting.Serialization.BinaryFormatter/GoreRemoting.Serialization.BinaryFormatter.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1 + netstandard2.0 osexpert, Hagen Siegel 2022 osexpert, 2022 Hagen Siegel enable diff --git a/GoreRemoting.Serialization.Json/GoreRemoting.Serialization.Json.csproj b/GoreRemoting.Serialization.Json/GoreRemoting.Serialization.Json.csproj index 1a712b4..46345d4 100644 --- a/GoreRemoting.Serialization.Json/GoreRemoting.Serialization.Json.csproj +++ b/GoreRemoting.Serialization.Json/GoreRemoting.Serialization.Json.csproj @@ -1,16 +1,17 @@  - net6.0 + netstandard2.0;net6.0 osexpert 2022 osexpert enable enable + - + diff --git a/GoreRemoting.Serialization.Json/JsonAdapter.cs b/GoreRemoting.Serialization.Json/JsonAdapter.cs index e1184e0..09ab2aa 100644 --- a/GoreRemoting.Serialization.Json/JsonAdapter.cs +++ b/GoreRemoting.Serialization.Json/JsonAdapter.cs @@ -3,7 +3,9 @@ using System.Text.Json; using System.Text.Json.Serialization; using GoreRemoting.Serialization.Json.ArgTypes; +#if NET6_0_OR_GREATER using TupleAsJsonArray; +#endif namespace GoreRemoting.Serialization.Json { @@ -23,7 +25,9 @@ private static JsonSerializerOptions CreateDefaultOptions() ReferenceHandler = ReferenceHandler.Preserve, Converters = { +#if NET6_0_OR_GREATER new TupleConverterFactory() +#endif }, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; diff --git a/GoreRemoting.Serialization.MessagePack/GoreRemoting.Serialization.MessagePack.csproj b/GoreRemoting.Serialization.MessagePack/GoreRemoting.Serialization.MessagePack.csproj index 2fba7f9..6d6e8e1 100644 --- a/GoreRemoting.Serialization.MessagePack/GoreRemoting.Serialization.MessagePack.csproj +++ b/GoreRemoting.Serialization.MessagePack/GoreRemoting.Serialization.MessagePack.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1 + netstandard2.0 osexpert 2022 osexpert enable diff --git a/GoreRemoting.Serialization.Protobuf/GoreRemoting.Serialization.Protobuf.csproj b/GoreRemoting.Serialization.Protobuf/GoreRemoting.Serialization.Protobuf.csproj index af1a282..1063b18 100644 --- a/GoreRemoting.Serialization.Protobuf/GoreRemoting.Serialization.Protobuf.csproj +++ b/GoreRemoting.Serialization.Protobuf/GoreRemoting.Serialization.Protobuf.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netstandard2.1 + netstandard2.0 osexpert 2022 osexpert enable diff --git a/TODO.txt b/TODO.txt index 452be24..4fda070 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,21 +1,8 @@ Intern strings like vs-streamjsonrpc? For messagepack. -Security? -During desser, somehow validate that the types sent match the signature of the method called? -If a method take object as arg, then its pointless off course, all will pass. -It is not easy to reach the method sig\types in the code that desser (for MessagePack nor possible at all since it happens within the library). -But I am not sure if this is a security problem. The only bad thing you can do is to serialize things that will fail to be used as argument -for target method, but I guess it would be better to detect this before deserialize of the type, -but it depends on, what bad thing can really happen by deserialize random types? -For binary formatter it is bad, but this is because the way to creates the objects, using reflection to call ctors. -Other serializers I don't think have these problems, so the harm you can do with them...I think it theoretical. -Anyways...this is all based on BinaryFormatter and migrating away from it, so security is not the main point here. -When all is migrated away from BinaryFormatter to some other formatter, then you could must easier switch the transport too. - CallContext ResultContext? Maybe an idea to separate them, have a separate context that flows back to the client... - session: client heartbeat @@ -47,47 +34,6 @@ OnUnobservedException OnException OnClientTriggeredException - - info.AddValue("ClassName", GetClassName(), typeof(string)); // Do not rename (binary serialization) - info.AddValue("Message", _message, typeof(string)); // Do not rename (binary serialization) - info.AddValue("Data", _data, typeof(IDictionary)); // Do not rename (binary serialization) - info.AddValue("InnerException", _innerException, typeof(Exception)); // Do not rename (binary serialization) - info.AddValue("HelpURL", _helpURL, typeof(string)); // Do not rename (binary serialization) - info.AddValue("StackTraceString", SerializationStackTraceString, typeof(string)); // Do not rename (binary serialization) - info.AddValue("RemoteStackTraceString", _remoteStackTraceString, typeof(string)); // Do not rename (binary serialization) - info.AddValue("RemoteStackIndex", 0, typeof(int)); // Do not rename (binary serialization) - info.AddValue("ExceptionMethod", null, typeof(string)); // Do not rename (binary serialization) - info.AddValue("HResult", _HResult); // Do not rename (binary serialization) - info.AddValue("Source", _source, typeof(string)); // Do not rename (binary serialization) - info.AddValue("WatsonBuckets", SerializationWatsonBuckets, typeof(byte[])); // Do not rename (binary serialization) - } - protected Exception(SerializationInfo info, StreamingContext context) - { - if (info == null) - throw new ArgumentNullException(nameof(info)); - - _message = info.GetString("Message"); // Do not rename (binary serialization) - _data = (IDictionary?)(info.GetValueNoThrow("Data", typeof(IDictionary))); // Do not rename (binary serialization) - _innerException = (Exception?)(info.GetValue("InnerException", typeof(Exception))); // Do not rename (binary serialization) - _helpURL = info.GetString("HelpURL"); // Do not rename (binary serialization) - _stackTraceString = info.GetString("StackTraceString"); // Do not rename (binary serialization) - _remoteStackTraceString = info.GetString("RemoteStackTraceString"); // Do not rename (binary serialization) - _HResult = info.GetInt32("HResult"); // Do not rename (binary serialization) - _source = info.GetString("Source"); // Do not rename (binary serialization) - - RestoreRemoteStackTrace(info, context); - } - -special ctor for exceptions? -has to be serializable? -Check this: StreamJsonRpc - -security: check that types are of same types in service methods? -so would loop methods with same name and same numer of args. Then check if types sent match those types, -and only then deserialize to real type. -BUT is this really a problem for json and memorypack etc? I dont think so... - - remote linq https://github.com/dotnet/csharplang/discussions/5555#discussioncomment-1852834 https://github.com/6bee/Remote.Linq @@ -97,8 +43,6 @@ callcontext vs headers \ trailers of grpc? meaning, could we make a GrpgCallHeaders static class, that works similar? and meaning, could we make a GrpgCallTrailers static class, that works similar? - - Use headers to tell what\if compression to use? Compress\compressor: Deflate, gzip, etc. Use separate methods for bidir and unary? So if no callback delegate arguments can use unary. diff --git a/global.json b/global.json index 4db6a48..97dd873 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0", + "version": "6.0", "rollForward": "latestMajor", "allowPrerelease": false } diff --git a/nuget push.bat b/nuget push.bat index e2021fe..2e0b5d7 100644 --- a/nuget push.bat +++ b/nuget push.bat @@ -1,9 +1,10 @@ REM set myKey= -set ver=0.0.1 +set ver=0.0.2 nuget push bin\Packages\Release\NuGet\GoreRemoting.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% nuget push bin\Packages\Release\NuGet\GoreRemoting.Compression.Lz4.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.BinaryFormatter.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.Json.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.MemoryPack.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% -nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.MessagePack.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% \ No newline at end of file +nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.MessagePack.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% +nuget push bin\Packages\Release\NuGet\GoreRemoting.Serialization.Protobuf.%ver%.nupkg -src https://api.nuget.org/v3/index.json -ApiKey %myKey% \ No newline at end of file