diff --git a/src/Hazelcast.Net.Tests/DotNet/MemoryTests.cs b/src/Hazelcast.Net.Tests/DotNet/MemoryTests.cs index fef6e76a9..771c1baa1 100644 --- a/src/Hazelcast.Net.Tests/DotNet/MemoryTests.cs +++ b/src/Hazelcast.Net.Tests/DotNet/MemoryTests.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -147,33 +147,6 @@ private int ReadInt32B(ref ReadOnlySequence bytes) return value; } - -#if NETCOREAPP3_1 // SequenceReader is n/a in 2.1 - private int ReadInt32C(ref ReadOnlySequence bytes) - { - if (bytes.Length < 4) - throw new ArgumentException("Not enough bytes.", nameof(bytes)); - - var slice = bytes.Slice(bytes.Start, 4); // slice the required bytes - int value; - if (slice.IsSingleSegment) - { - var span = slice.FirstSpan(); - value = span.ReadInt32(); - } - else - { - // use a reader - var reader = new SequenceReader(bytes); - reader.TryReadLittleEndian(out value); - } - - // consume the slice - bytes = bytes.Slice(slice.End); - - return value; - } -#endif } public static class Extensions diff --git a/src/Hazelcast.Net.Win32/Hazelcast.Net.Win32.csproj b/src/Hazelcast.Net.Win32/Hazelcast.Net.Win32.csproj index 001489132..52d62a0b9 100644 --- a/src/Hazelcast.Net.Win32/Hazelcast.Net.Win32.csproj +++ b/src/Hazelcast.Net.Win32/Hazelcast.Net.Win32.csproj @@ -43,8 +43,11 @@ - + + + + diff --git a/src/Hazelcast.Net/Exceptions/StackTraceElement.cs b/src/Hazelcast.Net/Exceptions/StackTraceElement.cs index 61ded48a2..7b9ad0ac4 100644 --- a/src/Hazelcast.Net/Exceptions/StackTraceElement.cs +++ b/src/Hazelcast.Net/Exceptions/StackTraceElement.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -91,7 +91,7 @@ private static bool EqualsN(StackTraceElement left, StackTraceElement right) /// public override int GetHashCode() { -#if NETFRAMEWORK || NETSTANDARD2_0 +#if NETSTANDARD2_0 unchecked { var hashCode = (ClassName != null ? ClassName.GetHashCode() : 0); diff --git a/src/Hazelcast.Net/Polyfills/Index.cs b/src/Hazelcast.Net/Polyfills/Index.cs index 5a2395673..59cb04155 100644 --- a/src/Hazelcast.Net/Polyfills/Index.cs +++ b/src/Hazelcast.Net/Polyfills/Index.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48 +#if NETSTANDARD2_0 // brings C# 8 index & range to netstandard 2.0 // see https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm diff --git a/src/Hazelcast.Net/Polyfills/NullableAttributes.cs b/src/Hazelcast.Net/Polyfills/NullableAttributes.cs index a853731b2..3e6026901 100644 --- a/src/Hazelcast.Net/Polyfills/NullableAttributes.cs +++ b/src/Hazelcast.Net/Polyfills/NullableAttributes.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ #pragma warning disable MA0048 // File name must match type name #define INTERNAL_NULLABLE_ATTRIBUTES -#if NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48 +#if NETSTANDARD2_0 // brings C# 8 nullable attributes to netstandard 2.0 // see https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm diff --git a/src/Hazelcast.Net/Polyfills/Range.cs b/src/Hazelcast.Net/Polyfills/Range.cs index 465188a91..44a5b6369 100644 --- a/src/Hazelcast.Net/Polyfills/Range.cs +++ b/src/Hazelcast.Net/Polyfills/Range.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48 +#if NETSTANDARD2_0 // brings C# 8 index & range to netstandard 2.0 // see https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm diff --git a/src/Hazelcast.Net/Polyfills/ReadOnlySequenceExtensions.cs b/src/Hazelcast.Net/Polyfills/ReadOnlySequenceExtensions.cs index 2bf4b17b8..a7690a5f3 100644 --- a/src/Hazelcast.Net/Polyfills/ReadOnlySequenceExtensions.cs +++ b/src/Hazelcast.Net/Polyfills/ReadOnlySequenceExtensions.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -36,7 +36,7 @@ internal static class ReadOnlySequenceExtensions /// public static ReadOnlySpan FirstSpan(this ReadOnlySequence sequence) { -#if NET462 || NETSTANDARD2_0 +#if NETSTANDARD2_0 return sequence.First.Span; #else return sequence.FirstSpan; diff --git a/src/Hazelcast.Net/Polyfills/RuntimeHelpersEx.cs b/src/Hazelcast.Net/Polyfills/RuntimeHelpersEx.cs index f146d981a..d5d304b55 100644 --- a/src/Hazelcast.Net/Polyfills/RuntimeHelpersEx.cs +++ b/src/Hazelcast.Net/Polyfills/RuntimeHelpersEx.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48 +#if NETSTANDARD2_0 // brings C# 8 index & range to netstandard 2.0 // see https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm diff --git a/src/Hazelcast.Net/Polyfills/StringExtensions.cs b/src/Hazelcast.Net/Polyfills/StringExtensions.cs index 6556accd7..bab19d33b 100644 --- a/src/Hazelcast.Net/Polyfills/StringExtensions.cs +++ b/src/Hazelcast.Net/Polyfills/StringExtensions.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ public static string TrimEnd(this string s, string trim) => s.EndsWith(trim) ? s.Substring(0, s.Length - trim.Length) : s; #pragma warning restore CA1310 // Specify StringComparison for correctness -#if NETFRAMEWORK || NETSTANDARD2_0 +#if NETSTANDARD2_0 #pragma warning disable CA1801 // Review unused parameters - we need them #pragma warning disable IDE0060 // Remove unused parameter diff --git a/src/Hazelcast.Net/Polyfills/TaskExtensions.cs b/src/Hazelcast.Net/Polyfills/TaskExtensions.cs index 3de0f5ae4..7c5784319 100644 --- a/src/Hazelcast.Net/Polyfills/TaskExtensions.cs +++ b/src/Hazelcast.Net/Polyfills/TaskExtensions.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ internal static class TaskExtensions public static bool IsCompletedSuccessfully(this Task task) { if (task == null) throw new ArgumentNullException(nameof(task)); -#if NETFRAMEWORK || NETSTANDARD2_0 +#if NETSTANDARD2_0 return task.IsCompleted && !(task.IsFaulted || task.IsCanceled); #else return task.IsCompletedSuccessfully; @@ -48,7 +48,7 @@ public static bool IsCompletedSuccessfully(this Task task) /// public static bool IsCompletedSuccessfully(this ValueTask task) { -#if NETFRAMEWORK || NETSTANDARD2_0 +#if NETSTANDARD2_0 return task.IsCompleted && !(task.IsFaulted || task.IsCanceled); #else return task.IsCompletedSuccessfully; @@ -65,7 +65,7 @@ public static bool IsCompletedSuccessfully(this ValueTask task) /// public static bool IsCompletedSuccessfully(this ValueTask task) { -#if NETFRAMEWORK || NETSTANDARD2_0 +#if NETSTANDARD2_0 return task.IsCompleted && !(task.IsFaulted || task.IsCanceled); #else return task.IsCompletedSuccessfully; diff --git a/src/Hazelcast.Net/Polyfills/ZLib/ZlibConstants.cs b/src/Hazelcast.Net/Polyfills/ZLib/ZlibConstants.cs index 4c87c586f..fdec966cd 100644 --- a/src/Hazelcast.Net/Polyfills/ZLib/ZlibConstants.cs +++ b/src/Hazelcast.Net/Polyfills/ZLib/ZlibConstants.cs @@ -3,9 +3,9 @@ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,7 +41,7 @@ internal static class ZlibConstants public const int Z_STREAM_END = 1; /// - /// The operation ended in need of a dictionary. + /// The operation ended in need of a dictionary. /// public const int Z_NEED_DICT = 2; @@ -63,11 +63,7 @@ internal static class ZlibConstants /// /// The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes. /// -#if NETCF - public const int WorkingBufferSizeDefault = 8192; -#else - public const int WorkingBufferSizeDefault = 16384; -#endif + public const int WorkingBufferSizeDefault = 16384; /// /// The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes. /// diff --git a/src/Hazelcast.Net/Projection/MultiAttributeProjection.cs b/src/Hazelcast.Net/Projection/MultiAttributeProjection.cs index 528857070..c873b8906 100644 --- a/src/Hazelcast.Net/Projection/MultiAttributeProjection.cs +++ b/src/Hazelcast.Net/Projection/MultiAttributeProjection.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. +// Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,11 +39,7 @@ public MultiAttributeProjection(string[] attributePaths) { if (string.IsNullOrWhiteSpace(attributePath)) throw new ArgumentException("No attribute path can be null nor empty.", nameof(attributePaths)); -#if NETFRAMEWORK - if (attributePath.Contains("[any]")) -#else if (attributePath.Contains("[any]", StringComparison.OrdinalIgnoreCase)) -#endif throw new ArgumentException("No attribute path can contain the '[any]' operator.", nameof(attributePaths)); }