Skip to content

Commit

Permalink
Target net462 for gRPC WinHttpHandler support
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Aug 31, 2023
1 parent 86a3d2c commit 77d9c3c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
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
}

0 comments on commit 77d9c3c

Please sign in to comment.