Skip to content

Commit

Permalink
- Resolved protobuf-net#330
Browse files Browse the repository at this point in the history
- Used protobuf-net 3.2.30
  • Loading branch information
Dona278 committed Oct 17, 2024
1 parent 062c184 commit 3dc162c
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 127 deletions.
94 changes: 47 additions & 47 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
<Project>
<PropertyGroup>
<DefaultTFM>net8.0</DefaultTFM>
<RootNamespace>ProtoBuf.Grpc</RootNamespace>
<Authors>Marc Gravell</Authors>
<OutputType>Library</OutputType>
<SignAssembly>true</SignAssembly>
<DelaySign>False</DelaySign>
<NoWarn>NU5105;CS1701;BC42016;MSB3884;NETSDK1057;CS8632;IDE0090;IDE0057;xUnit1004</NoWarn>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ProtoBuf.snk</AssemblyOriginatorKeyFile>
<Copyright>Marc Gravell, 2019-</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/protobuf-net/protobuf-net.Grpc</PackageProjectUrl>
<RepositoryUrl>https://github.com/protobuf-net/protobuf-net.Grpc</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Product>protobuf-net.Grpc ($(TargetFramework))</Product>
<PackageReleaseNotes>https://protobuf-net.github.io/protobuf-net.Grpc/releasenotes#$(VersionPrefix)</PackageReleaseNotes>
<PropertyGroup>
<DefaultTFM>net8.0</DefaultTFM>
<RootNamespace>ProtoBuf.Grpc</RootNamespace>
<Authors>Marc Gravell</Authors>
<OutputType>Library</OutputType>
<SignAssembly>true</SignAssembly>
<DelaySign>False</DelaySign>
<NoWarn>NU5105;CS1701;BC42016;MSB3884;NETSDK1057;CS8632;IDE0090;IDE0057;xUnit1004</NoWarn>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)ProtoBuf.snk</AssemblyOriginatorKeyFile>
<Copyright>Marc Gravell, 2019-</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/protobuf-net/protobuf-net.Grpc</PackageProjectUrl>
<RepositoryUrl>https://github.com/protobuf-net/protobuf-net.Grpc</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Product>protobuf-net.Grpc ($(TargetFramework))</Product>
<PackageReleaseNotes>https://protobuf-net.github.io/protobuf-net.Grpc/releasenotes#$(VersionPrefix)</PackageReleaseNotes>

<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PackageTags>grpc</PackageTags>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<!--<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>-->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PackageTags>grpc</PackageTags>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<!--<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>-->

<ExampleRefs>local</ExampleRefs>
<!-- local or nuget-->
<ExampleRefs>local</ExampleRefs>
<!-- local or nuget-->

<ProtoBufNet2Version>2.4.8</ProtoBufNet2Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release' or '$(Configuration)'=='VS'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Optimize>true</Optimize>
</PropertyGroup>
<ProtoBufNet2Version>2.4.8</ProtoBufNet2Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release' or '$(Configuration)'=='VS'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Optimize>true</Optimize>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release' and '$(SourceRoot)'==''">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release' and '$(SourceRoot)'==''">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" />
</ItemGroup>
</Project>
68 changes: 34 additions & 34 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<Project>
<ItemGroup>
<PackageVersion Include="protobuf-net" Version="3.2.30" />
<PackageVersion Include="protobuf-net.BuildTools" Version="3.2.33" />
<PackageVersion Include="protobuf-net.Core" Version="3.2.30" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Reflection" Version="3.2.12" />
<PackageVersion Include="Google.Protobuf" Version="3.28.2" />
<PackageVersion Include="Grpc" Version="2.46.6" />
<PackageVersion Include="Grpc.Core" Version="2.46.6" />
<PackageVersion Include="Grpc.Tools" Version="2.67.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" />
<PackageVersion Include="Grpc.Core.Api" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore.Server" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.66.0" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.66.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.143" />
<PackageVersion Include="System.IO.Pipelines" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.ServiceModel.Primitives" Version="8.0.0" />
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="TaskBuilder.fs" Version="2.1.0" />
<PackageVersion Include="FSharp.Core" Version="8.0.401" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="protobuf-net" Version="3.2.30" />
<PackageVersion Include="protobuf-net.BuildTools" Version="3.2.33" />
<PackageVersion Include="protobuf-net.Core" Version="3.2.30" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.2.2" />
<PackageVersion Include="protobuf-net.Reflection" Version="3.2.12" />
<PackageVersion Include="Google.Protobuf" Version="3.28.2" />
<PackageVersion Include="Grpc" Version="2.46.6" />
<PackageVersion Include="Grpc.Core" Version="2.46.6" />
<PackageVersion Include="Grpc.Tools" Version="2.67.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" />
<PackageVersion Include="Grpc.Core.Api" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore.Server" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.66.0" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.66.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.143" />
<PackageVersion Include="System.IO.Pipelines" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.ServiceModel.Primitives" Version="8.0.0" />
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="TaskBuilder.fs" Version="2.1.0" />
<PackageVersion Include="FSharp.Core" Version="8.0.401" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<RootNamespace>ProtoBuf.Grpc.Server</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\protobuf-net.Grpc\protobuf-net.Grpc.csproj" />
<PackageReference Include="Grpc.AspNetCore.Server" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<RootNamespace>ProtoBuf.Grpc.Server</RootNamespace>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/protobuf-net/protobuf-net.Grpc</RepositoryUrl>

<!-- Hexesoft -->
<PackageId>Hexesoft.ProtoBuf.Grpc.Server</PackageId>
<IsPackable>true</IsPackable>
<PackageProjectUrl>https://github.com/hexesoft/protobuf-net.Grpc</PackageProjectUrl>
<GeneratePackageOnBuild Condition="'$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
<Version Condition="'$(BUILD_BUILDNUMBER)' == ''">$([System.DateTime]::Now.ToString('yyyy.M.d'))-dev</Version>
<Version Condition="'$(BUILD_BUILDNUMBER)' != ''">$(BUILD_BUILDNUMBER)</Version>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\protobuf-net.Grpc\protobuf-net.Grpc.csproj" />
<PackageReference Include="Grpc.AspNetCore.Server" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<RootNamespace>ProtoBuf.Grpc.ClientFactory</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<RootNamespace>ProtoBuf.Grpc.ClientFactory</RootNamespace>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/protobuf-net/protobuf-net.Grpc</RepositoryUrl>

<!-- Hexesoft -->
<PackageId>Hexesoft.ProtoBuf.Grpc.ClientFactory</PackageId>
<IsPackable>true</IsPackable>
<PackageProjectUrl>https://github.com/hexesoft/protobuf-net.Grpc</PackageProjectUrl>
<GeneratePackageOnBuild Condition="'$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
<Version Condition="'$(BUILD_BUILDNUMBER)' == ''">$([System.DateTime]::Now.ToString('yyyy.M.d'))-dev</Version>
<Version Condition="'$(BUILD_BUILDNUMBER)' != ''">$(BUILD_BUILDNUMBER)</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.Net.ClientFactory" />
<ProjectReference Include="..\protobuf-net.Grpc\protobuf-net.Grpc.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.Net.ClientFactory" />
<ProjectReference Include="..\protobuf-net.Grpc\protobuf-net.Grpc.csproj" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions src/protobuf-net.Grpc/Configuration/ServerBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public int Bind(object state, Type serviceType, BinderConfiguration? binderConfi
Type[] typesBuffer = [];
binderConfiguration ??= BinderConfiguration.Default;
var potentialServiceContracts = typeof(IGrpcService).IsAssignableFrom(serviceType)
? new HashSet<Type> {serviceType}
? new HashSet<Type> { serviceType }
: ContractOperation.ExpandInterfaces(serviceType);

bool serviceImplSimplifiedExceptions = serviceType.IsDefined(typeof(SimpleRpcExceptionsAttribute));
Expand All @@ -50,7 +50,7 @@ public int Bind(object state, Type serviceType, BinderConfiguration? binderConfi

// now that we know it is a service contract type for sure
var serviceContract = potentialServiceContract;

var typesToBeIncludedInMethodsBinding =
ContractOperation.ExpandWithInterfacesMarkedAsSubService(binderConfiguration.Binder, serviceContract);

Expand All @@ -64,7 +64,7 @@ public int Bind(object state, Type serviceType, BinderConfiguration? binderConfi
var serviceContractSimplifiedExceptions = serviceImplSimplifiedExceptions ||
typeToBindItsMethods.IsDefined(
typeof(SimpleRpcExceptionsAttribute));
var bindCtx = new ServiceBindContext(serviceContract, serviceType, state, binderConfiguration.Binder);
var bindCtx = new ServiceBindContext(typeToBindItsMethods, serviceType, state, binderConfiguration.Binder);
foreach (var op in ContractOperation.FindOperations(binderConfiguration, typeToBindItsMethods, this))
{
if (ServerInvokerLookup.TryGetValue(op.MethodType, op.Context, op.Arg, op.Result, op.Void, out var invoker)
Expand Down Expand Up @@ -114,7 +114,7 @@ bool AddMethod(string? serviceName, Type @in, Type @out, string on, MethodInfo m
// 6, 7 set during array initialization
argsBuffer[8] = simplifiedExceptionHandling;

return (bool) s_addMethod.MakeGenericMethod(typesBuffer).Invoke(this, argsBuffer)!;
return (bool)s_addMethod.MakeGenericMethod(typesBuffer).Invoke(this, argsBuffer)!;
}
catch (Exception fail)
{
Expand Down Expand Up @@ -180,7 +180,7 @@ public TDelegate CreateDelegate<TDelegate>()
else
{
// basic - direct call
return (TDelegate) Delegate.CreateDelegate(typeof(TDelegate), _service, Method);
return (TDelegate)Delegate.CreateDelegate(typeof(TDelegate), _service, Method);
}
}
else
Expand Down Expand Up @@ -234,8 +234,8 @@ static Expression ApplySimpleExceptionHandling(Expression body)
#pragma warning disable CS0618
private static readonly Dictionary<int, MethodInfo> s_ReshapeWithSimpleExceptionHandling =
(from method in typeof(Reshape).GetMethods(BindingFlags.Public | BindingFlags.Static)
where method.Name is nameof(Reshape.WithSimpleExceptionHandling)
select method)
where method.Name is nameof(Reshape.WithSimpleExceptionHandling)
select method)
.ToDictionary(method => method.IsGenericMethodDefinition ? method.GetGenericArguments().Length : 0);
#pragma warning restore CS0618

Expand Down
45 changes: 23 additions & 22 deletions src/protobuf-net.Grpc/protobuf-net.Grpc.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.1;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<RootNamespace>ProtoBuf.Grpc</RootNamespace>
<DefineConstants>$(DefineConstants);PLAT_NO_CHANNEL_READALLASYNC</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.Core.Api" />
<PackageReference Include="protobuf-net" VersionOverride="$(ProtoBufNet2Version)" />
<PackageReference Include="System.IO.Pipelines" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Threading.Channels" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<!-- need to be explicit to avoid fight with System.IO.Pipelines -->
<PackageReference Include="System.ValueTuple" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Threading.Channels" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);PLAT_NO_CHANNEL_READALLASYNC</DefineConstants>
<RootNamespace>ProtoBuf.Grpc</RootNamespace>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/protobuf-net/protobuf-net.Grpc</RepositoryUrl>

<!-- Hexesoft -->
<PackageId>Hexesoft.ProtoBuf.Grpc</PackageId>
<PackageProjectUrl>https://github.com/hexesoft/protobuf-net.Grpc</PackageProjectUrl>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild Condition="'$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
<Version Condition="'$(BUILD_BUILDNUMBER)' == ''">$([System.DateTime]::Now.ToString('yyyy.M.d'))-dev</Version>
<Version Condition="'$(BUILD_BUILDNUMBER)' != ''">$(BUILD_BUILDNUMBER)</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.Core.Api" />
<PackageReference Include="protobuf-net" />
<PackageReference Include="System.IO.Pipelines" />
</ItemGroup>

</Project>

0 comments on commit 3dc162c

Please sign in to comment.