Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions src/Hazelcast.Net.Tests/DotNet/MemoryTests.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -147,33 +147,6 @@ private int ReadInt32B(ref ReadOnlySequence<byte> bytes)

return value;
}

#if NETCOREAPP3_1 // SequenceReader is n/a in 2.1
private int ReadInt32C(ref ReadOnlySequence<byte> 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<byte>(bytes);
reader.TryReadLittleEndian(out value);
}

// consume the slice
bytes = bytes.Slice(slice.End);

return value;
}
#endif
}

public static class Extensions
Expand Down
5 changes: 4 additions & 1 deletion src/Hazelcast.Net.Win32/Hazelcast.Net.Win32.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
<!-- ContinuousIntegrationBuild is set via a dotnet pack option -->
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Memory" Version="4.6.3" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Exceptions/StackTraceElement.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -91,7 +91,7 @@ private static bool EqualsN(StackTraceElement left, StackTraceElement right)
/// <inheritdoc />
public override int GetHashCode()
{
#if NETFRAMEWORK || NETSTANDARD2_0
#if NETSTANDARD2_0
unchecked
{
var hashCode = (ClassName != null ? ClassName.GetHashCode() : 0);
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/Index.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/NullableAttributes.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and other similar swaps between netstandart2.0 and net framework

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above about these being controlling compilation and the current frameworks.

#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
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/Range.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/ReadOnlySequenceExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -36,7 +36,7 @@ internal static class ReadOnlySequenceExtensions
/// </remarks>
public static ReadOnlySpan<T> FirstSpan<T>(this ReadOnlySequence<T> sequence)
{
#if NET462 || NETSTANDARD2_0
#if NETSTANDARD2_0
return sequence.First.Span;
#else
return sequence.FirstSpan;
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/RuntimeHelpersEx.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Hazelcast.Net/Polyfills/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions src/Hazelcast.Net/Polyfills/TaskExtensions.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -48,7 +48,7 @@ public static bool IsCompletedSuccessfully(this Task task)
/// </remarks>
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;
Expand All @@ -65,7 +65,7 @@ public static bool IsCompletedSuccessfully(this ValueTask task)
/// </remarks>
public static bool IsCompletedSuccessfully<T>(this ValueTask<T> task)
{
#if NETFRAMEWORK || NETSTANDARD2_0
#if NETSTANDARD2_0
return task.IsCompleted && !(task.IsFaulted || task.IsCanceled);
#else
return task.IsCompletedSuccessfully;
Expand Down
12 changes: 4 additions & 8 deletions src/Hazelcast.Net/Polyfills/ZLib/ZlibConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -41,7 +41,7 @@ internal static class ZlibConstants
public const int Z_STREAM_END = 1;

/// <summary>
/// The operation ended in need of a dictionary.
/// The operation ended in need of a dictionary.
/// </summary>
public const int Z_NEED_DICT = 2;

Expand All @@ -63,11 +63,7 @@ internal static class ZlibConstants
/// <summary>
/// The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
/// </summary>
#if NETCF
public const int WorkingBufferSizeDefault = 8192;
#else
public const int WorkingBufferSizeDefault = 16384;
#endif
public const int WorkingBufferSizeDefault = 16384;
/// <summary>
/// The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
/// </summary>
Expand Down
10 changes: 3 additions & 7 deletions src/Hazelcast.Net/Projection/MultiAttributeProjection.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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]"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you revert this change since we target framework and behavior of methods is not same with core?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am looking at it but can you show me where we are targeting framework?

#else
if (attributePath.Contains("[any]", StringComparison.OrdinalIgnoreCase))
#endif
throw new ArgumentException("No attribute path can contain the '[any]' operator.", nameof(attributePaths));
}

Expand Down
Loading