From 74c1a6f11546deae0edb9e00bdc53ee0897b4879 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:08:08 +0000 Subject: [PATCH 1/3] Migrate to just netstandard2.0 target framework --- .../Expressive.Tests/Expressive.Tests.csproj | 2 +- .../Exceptions/ExpressiveException.cs | 3 - .../FunctionNameAlreadyRegisteredException.cs | 22 ------- .../Exceptions/MissingParticipantException.cs | 3 - .../Exceptions/MissingTokenException.cs | 22 ------- .../OperatorNameAlreadyRegisteredException.cs | 23 ------- .../ParameterCountMismatchException.cs | 3 - .../Exceptions/UnrecognisedTokenException.cs | 23 ------- Source/Expressive/Expression.cs | 4 -- Source/Expressive/Expressive.csproj | 4 +- Source/Expressive/Helpers/TypeHelper.cs | 63 +------------------ 11 files changed, 4 insertions(+), 168 deletions(-) diff --git a/Source/Expressive.Tests/Expressive.Tests.csproj b/Source/Expressive.Tests/Expressive.Tests.csproj index 2d6c68e..5789ea3 100644 --- a/Source/Expressive.Tests/Expressive.Tests.csproj +++ b/Source/Expressive.Tests/Expressive.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;netcoreapp3.1;net45 + net6.0;net7.0;net8.0 false diff --git a/Source/Expressive/Exceptions/ExpressiveException.cs b/Source/Expressive/Exceptions/ExpressiveException.cs index e87cd13..fe1dbab 100644 --- a/Source/Expressive/Exceptions/ExpressiveException.cs +++ b/Source/Expressive/Exceptions/ExpressiveException.cs @@ -5,9 +5,6 @@ namespace Expressive.Exceptions /// /// The main exposed for users of an Expression. Check the InnerException for more information. /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class ExpressiveException : Exception { internal ExpressiveException(string message) : base(message) diff --git a/Source/Expressive/Exceptions/FunctionNameAlreadyRegisteredException.cs b/Source/Expressive/Exceptions/FunctionNameAlreadyRegisteredException.cs index 51e31a3..0ff6ea9 100644 --- a/Source/Expressive/Exceptions/FunctionNameAlreadyRegisteredException.cs +++ b/Source/Expressive/Exceptions/FunctionNameAlreadyRegisteredException.cs @@ -1,18 +1,11 @@ using System; using Expressive.Functions; -#if !NETSTANDARD1_4 -using System.Runtime.Serialization; -using System.Security.Permissions; -#endif namespace Expressive.Exceptions { /// /// Represents an error that is thrown when registering an and the name is already used. /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class FunctionNameAlreadyRegisteredException : Exception { /// @@ -29,20 +22,5 @@ internal FunctionNameAlreadyRegisteredException(string name) { this.Name = name; } - -#if !NETSTANDARD1_4 - /// - /// Set the with information about this exception. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - - info.AddValue("Name", Name); - } -#endif } } diff --git a/Source/Expressive/Exceptions/MissingParticipantException.cs b/Source/Expressive/Exceptions/MissingParticipantException.cs index d6eecd0..84c68c1 100644 --- a/Source/Expressive/Exceptions/MissingParticipantException.cs +++ b/Source/Expressive/Exceptions/MissingParticipantException.cs @@ -5,9 +5,6 @@ namespace Expressive.Exceptions /// /// Represents an error that is thrown when one side of an operation is missing inside an . /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class MissingParticipantException : Exception { /// diff --git a/Source/Expressive/Exceptions/MissingTokenException.cs b/Source/Expressive/Exceptions/MissingTokenException.cs index 4959792..5d3b418 100644 --- a/Source/Expressive/Exceptions/MissingTokenException.cs +++ b/Source/Expressive/Exceptions/MissingTokenException.cs @@ -1,17 +1,10 @@ using System; -#if !NETSTANDARD1_4 -using System.Runtime.Serialization; -using System.Security.Permissions; -#endif namespace Expressive.Exceptions { /// /// Represents an error that is thrown when a missing token is detected inside an . /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class MissingTokenException : Exception { /// @@ -29,20 +22,5 @@ internal MissingTokenException(string message, char missingToken) { this.MissingToken = missingToken; } - -#if !NETSTANDARD1_4 - /// - /// Set the with information about this exception. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - - info.AddValue("MissingToken", MissingToken); - } -#endif } } diff --git a/Source/Expressive/Exceptions/OperatorNameAlreadyRegisteredException.cs b/Source/Expressive/Exceptions/OperatorNameAlreadyRegisteredException.cs index 059322d..5e30fef 100644 --- a/Source/Expressive/Exceptions/OperatorNameAlreadyRegisteredException.cs +++ b/Source/Expressive/Exceptions/OperatorNameAlreadyRegisteredException.cs @@ -1,19 +1,11 @@ using System; using Expressive.Operators; -#if !NETSTANDARD1_4 -using System.Runtime.Serialization; -using System.Security.Permissions; -#endif - namespace Expressive.Exceptions { /// /// Represents an error that is thrown when registering an and the name is already used. /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class OperatorNameAlreadyRegisteredException : Exception { /// @@ -30,20 +22,5 @@ internal OperatorNameAlreadyRegisteredException(string tag) { this.Tag = tag; } - -#if !NETSTANDARD1_4 - /// - /// Set the with information about this exception. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - - info.AddValue("Tag", Tag); - } -#endif } } diff --git a/Source/Expressive/Exceptions/ParameterCountMismatchException.cs b/Source/Expressive/Exceptions/ParameterCountMismatchException.cs index 0541d15..b46ac1f 100644 --- a/Source/Expressive/Exceptions/ParameterCountMismatchException.cs +++ b/Source/Expressive/Exceptions/ParameterCountMismatchException.cs @@ -5,9 +5,6 @@ namespace Expressive.Exceptions /// /// Represents an error that is thrown when a function has an incorrect number of parameters. /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class ParameterCountMismatchException : Exception { /// diff --git a/Source/Expressive/Exceptions/UnrecognisedTokenException.cs b/Source/Expressive/Exceptions/UnrecognisedTokenException.cs index 1d94881..37184b8 100644 --- a/Source/Expressive/Exceptions/UnrecognisedTokenException.cs +++ b/Source/Expressive/Exceptions/UnrecognisedTokenException.cs @@ -1,18 +1,10 @@ using System; -#if !NETSTANDARD1_4 -using System.Runtime.Serialization; -using System.Security.Permissions; -#endif - namespace Expressive.Exceptions { /// /// Represents an error that is thrown when a token is not recognised inside an . /// -#if !NETSTANDARD1_4 - [Serializable] -#endif public sealed class UnrecognisedTokenException : Exception { /// @@ -29,20 +21,5 @@ internal UnrecognisedTokenException(string token) { this.Token = token; } - -#if !NETSTANDARD1_4 - /// - /// Set the with information about this exception. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - - info.AddValue("Token", Token); - } -#endif } } diff --git a/Source/Expressive/Expression.cs b/Source/Expressive/Expression.cs index 6a25b99..76ff83d 100644 --- a/Source/Expressive/Expression.cs +++ b/Source/Expressive/Expression.cs @@ -199,11 +199,7 @@ public void EvaluateAsync(Action callback, IDictionary -#else - ThreadPool.QueueUserWorkItem((o) => -#endif { var result = default(T); string message = null; diff --git a/Source/Expressive/Expressive.csproj b/Source/Expressive/Expressive.csproj index 3765f2f..9afa90f 100644 --- a/Source/Expressive/Expressive.csproj +++ b/Source/Expressive/Expressive.csproj @@ -1,7 +1,7 @@  - netstandard1.4;netstandard2.0;net45 + netstandard2.0 true ..\ExpressiveStrongName.snk 0.0.0.0 @@ -13,7 +13,7 @@ https://github.com/bijington/expressive Expressive Parser A multi-platform expression parsing and evaluating framework. - Copyright(c) 2020 Shaun Lawrence + Copyright(c) 2024 Shaun Lawrence Expression Parser Evaluator Cross-Platform NET Standard Xamarin Xamarin.Forms logo-64.png diff --git a/Source/Expressive/Helpers/TypeHelper.cs b/Source/Expressive/Helpers/TypeHelper.cs index da3e5c2..441e673 100644 --- a/Source/Expressive/Helpers/TypeHelper.cs +++ b/Source/Expressive/Helpers/TypeHelper.cs @@ -14,68 +14,7 @@ public static class TypeHelper /// The code of the underlying type, or if type is null. public static TypeCode GetTypeCode(object value) { - var typeCode = TypeCode.Object; - -#if NETSTANDARD1_4 - // TODO: Explore converting all numbers to decimal and simplifying all of this. - - switch (value) - { - case bool _: - typeCode = TypeCode.Boolean; - break; - case byte _: - typeCode = TypeCode.Byte; - break; - case char _: - typeCode = TypeCode.Char; - break; - case DateTime _: - typeCode = TypeCode.DateTime; - break; - case decimal _: - typeCode = TypeCode.Decimal; - break; - case double _: - typeCode = TypeCode.Double; - break; - case long _: - typeCode = TypeCode.Int64; - break; - case int _: - typeCode = TypeCode.Int32; - break; - case short _: - typeCode = TypeCode.Int16; - break; - case sbyte _: - typeCode = TypeCode.SByte; - break; - case float _: - typeCode = TypeCode.Single; - break; - case string _: - typeCode = TypeCode.String; - break; - case ushort _: - typeCode = TypeCode.UInt16; - break; - case uint _: - typeCode = TypeCode.UInt32; - break; - case ulong _: - typeCode = TypeCode.UInt64; - break; - case null: - typeCode = TypeCode.Empty; - break; - } - -#else - typeCode = Type.GetTypeCode(value?.GetType()); -#endif - - return typeCode; + return Type.GetTypeCode(value?.GetType()); } } } From 986e38f7ebdf91f90144059a75bf48acf090f945 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:18:45 +0000 Subject: [PATCH 2/3] Install .NET dependencies --- .github/workflows/dotnet-core.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index af47304..a91cefb 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -12,14 +12,18 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 - - name: Setup .NET 2.1.X Core - uses: actions/setup-dotnet@v1 + - name: Setup .NET 6.X + uses: actions/setup-dotnet@v2 with: - dotnet-version: 2.1.x - - name: Setup .NET 3.1.X Core - uses: actions/setup-dotnet@v1 + dotnet-version: 6.x + - name: Setup .NET 7.X + uses: actions/setup-dotnet@v2 with: - dotnet-version: 3.1.x + dotnet-version: 7.x + - name: Setup .NET 8.X + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 8.x - name: where are we? run: ls - name: Install dependencies From 2d5467ce6876a8ad99845b9c0190d1996639a6e0 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:32:55 +0000 Subject: [PATCH 3/3] Basic change to force action run --- Source/Expressive/Expressive.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Expressive/Expressive.csproj b/Source/Expressive/Expressive.csproj index 9afa90f..546c3a4 100644 --- a/Source/Expressive/Expressive.csproj +++ b/Source/Expressive/Expressive.csproj @@ -50,4 +50,4 @@ - + \ No newline at end of file