Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target net462 for gRPC WinHttpHandler support #32

Merged
merged 1 commit into from
Sep 4, 2023
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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>

<ItemGroup>
<PackageVersion Include="Google.Protobuf" Version="3.23.4" />
<PackageVersion Include="Grpc.Net.Client" Version="2.55.0" />
<PackageVersion Include="Grpc.Tools" Version="2.56.2" />
<PackageVersion Include="Google.Protobuf" Version="3.24.2" />
<PackageVersion Include="Grpc.Net.Client" Version="2.56.0" />
<PackageVersion Include="Grpc.Tools" Version="2.57.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />

Expand Down
2 changes: 1 addition & 1 deletion Milvus.Client/Diagnostics/CompilerAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace System.Runtime.CompilerServices;

#if NETSTANDARD2_0
#if NETSTANDARD2_0 || NET462

using ComponentModel;

Expand Down
5 changes: 3 additions & 2 deletions Milvus.Client/Milvus.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<!-- We target net462 directly since the net462 version of Grpc.Net.Client automatically uses WinHttpHandler -->
<TargetFrameworks>net6.0;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks Condition="'$(DeveloperBuild)' == 'True'">net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AnalysisMode>All</AnalysisMode>
Expand Down Expand Up @@ -43,7 +44,7 @@
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net462'">
<PackageReference Include="Microsoft.Bcl.HashCode" />
</ItemGroup>

Expand Down
16 changes: 15 additions & 1 deletion Milvus.Client/MilvusException.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
namespace Milvus.Client;
#if NET462
using System.Runtime.Serialization;
#endif

namespace Milvus.Client;

/// <summary>
/// Exception thrown for errors related to the Milvus client.
/// </summary>
#if NET462
[Serializable]
#endif
public sealed class MilvusException : Exception
{
/// <summary>
Expand Down Expand Up @@ -33,4 +40,11 @@ public MilvusException(MilvusErrorCode errorCode, string reason)
{
ErrorCode = errorCode;
}

#if NET462
private MilvusException(SerializationInfo info, StreamingContext context)
{
info.AddValue(nameof(ErrorCode), ErrorCode);
}
#endif
}