Skip to content

Commit

Permalink
Revert "Update .NET 9 SDK and resolve warnings (grpc#2502)"
Browse files Browse the repository at this point in the history
This reverts commit cd875d9.
  • Loading branch information
apolcyn committed Aug 19, 2024
1 parent c397bc7 commit bd1b194
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 400 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ launchSettings.json
BenchmarkDotNet.Artifacts/
BDN.Generated/
binaries/
global.json
.vscode/
*.binlog
build/feed
Expand Down
14 changes: 8 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<MicrosoftAspNetCoreAppPackageVersion>9.0.0-preview.5.24306.11</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftAspNetCoreApp8PackageVersion>8.0.6</MicrosoftAspNetCoreApp8PackageVersion>
<MicrosoftAspNetCoreApp7PackageVersion>7.0.5</MicrosoftAspNetCoreApp7PackageVersion>
<MicrosoftAspNetCoreApp6PackageVersion>6.0.33</MicrosoftAspNetCoreApp6PackageVersion>
<MicrosoftAspNetCoreApp6PackageVersion>6.0.11</MicrosoftAspNetCoreApp6PackageVersion>
<GrpcDotNetPackageVersion>2.63.0</GrpcDotNetPackageVersion>
<OpenTelemetryPackageVersion>1.6.0</OpenTelemetryPackageVersion>
<OpenTelemetryIntergationPackageVersion>1.8.1</OpenTelemetryIntergationPackageVersion>
Expand Down Expand Up @@ -57,20 +57,21 @@
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="$(OpenTelemetryIntergationPackageVersion)" />

<!-- Other -->
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
<PackageVersion Include="CommandLineParser" Version="2.5.0" />
<PackageVersion Include="Google.Api.CommonProtos" Version="2.15.0" />
<PackageVersion Include="Google.Apis.Auth" Version="1.68.0" />
<PackageVersion Include="Google.Apis.Auth" Version="1.46.0" />
<PackageVersion Include="Google.Protobuf" Version="3.27.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageVersion Include="Microsoft.Build" Version="17.3.2" />
<PackageVersion Include="Microsoft.Build" Version="16.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0-preview.24216.2" />
<PackageVersion Include="Microsoft.Crank.EventSources" Version="0.2.0-alpha.21255.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Testing" Version="2.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="4.6.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="Moq" Version="4.16.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Nunit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
Expand All @@ -79,9 +80,10 @@
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.CommandLine.Rendering" Version="0.4.0-alpha.22272.1" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<PackageVersion Include="System.IO.Pipelines" Version="5.0.1" />
<PackageVersion Include="System.Memory" Version="4.5.3" />
<PackageVersion Include="System.Net.Http.WinHttpHandler" Version="8.0.0" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.Security.Principal.Windows" Version="4.7.0" />
<PackageVersion Include="System.Threading.Channels" Version="4.6.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/Certifier/Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static HttpClientHandler CreateHttpHandler(bool includeClientCertificate)
// Load client certificate
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var certPath = Path.Combine(basePath!, "Certs", "client.pfx");
var clientCertificate = X509CertificateLoader.LoadPkcs12FromFile(certPath, "1111");
var clientCertificate = new X509Certificate2(certPath, "1111");
handler.ClientCertificates.Add(clientCertificate);
}

Expand Down
5 changes: 1 addition & 4 deletions examples/Container/Frontend/Frontend.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<!-- Suppress obsolete error in code generated by Razor. -->
<!-- CS0618: 'Router.PreferExactMatches' is obsolete: 'This property is obsolete and configuring it has not effect.' -->
<NoWarn>$(NoWarn);CS0618</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions examples/Container/deploy.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
docker compose -f .\docker-compose.yml build container-frontend
docker compose -f .\docker-compose.yml build container-backend
docker-compose -f .\docker-compose.yml build container-frontend
docker-compose -f .\docker-compose.yml build container-backend

kubectl delete -f .\Kubernetes\deploy-backend.yml
kubectl apply -f .\Kubernetes\deploy-backend.yml

kubectl delete -f .\Kubernetes\deploy-frontend.yml
kubectl apply -f .\Kubernetes\deploy-frontend.yml
kubectl apply -f .\Kubernetes\deploy-frontend.yml
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100-preview.7.24407.12",
"version": "9.0.100-preview.5.24305.3",
"rollForward": "latestFeature"
}
}
12 changes: 6 additions & 6 deletions grpcweb_interoptests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ set -ex

echo "Starting gRPC-Web interop test containers"

docker compose -f docker-compose.yml build grpcweb-server
docker compose -f docker-compose.yml build grpcweb-client
docker-compose -f docker-compose.yml build grpcweb-server
docker-compose -f docker-compose.yml build grpcweb-client

docker compose -f docker-compose.yml up -d grpcweb-server
docker compose -f docker-compose.yml up -d grpcweb-client
docker-compose -f docker-compose.yml up -d grpcweb-server
docker-compose -f docker-compose.yml up -d grpcweb-client

sleep 5

Expand All @@ -34,6 +34,6 @@ cd ../../..

echo "Remove all containers"

docker compose down
docker-compose down

echo "gRPC-Web interop tests finished"
echo "gRPC-Web interop tests finished"
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="System.IO.Pipelines" />
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions perf/benchmarkapps/GrpcClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ private static ChannelBase CreateChannel(string target)
{
var basePath = Path.GetDirectoryName(AppContext.BaseDirectory);
var certPath = Path.Combine(basePath!, "Certs", "client.pfx");
var clientCertificates = X509CertificateLoader.LoadPkcs12CollectionFromFile(certPath, "1111");
httpClientHandler.SslOptions.ClientCertificates = clientCertificates;
var clientCertificate = new X509Certificate2(certPath, "1111");
httpClientHandler.SslOptions.ClientCertificates = new X509CertificateCollection
{
clientCertificate
};
}
#if NET5_0_OR_GREATER
if (!string.IsNullOrEmpty(_options.UdsFileName))
Expand Down
4 changes: 0 additions & 4 deletions test/FunctionalTests/Balancer/ConnectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,7 @@ Task<HelloReply> UnaryMethod(HelloRequest request, ServerCallContext context)
// even after specifying the correct host override.
var basePath = Path.GetDirectoryName(typeof(InProcessTestServer).Assembly.Location);
var certPath = Path.Combine(basePath!, "localhost.pfx");
#if NET9_0_OR_GREATER
var cert = X509CertificateLoader.LoadPkcs12FromFile(certPath, "11111");
#else
var cert = new X509Certificate2(certPath, "11111");
#endif

// Arrange
using var endpoint1 = BalancerHelpers.CreateGrpcEndpoint<HelloRequest, HelloReply>(UnaryMethod, nameof(UnaryMethod), HttpProtocols.Http1AndHttp2, isHttps: true, certificate: cert);
Expand Down
3 changes: 2 additions & 1 deletion test/FunctionalTests/Grpc.AspNetCore.FunctionalTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<Compile Include="..\Shared\BalancerWaitHelpers.cs" Link="Infrastructure\Balancer\BalancerWaitHelpers.cs" />
<Compile Include="..\Shared\CallbackInterceptor.cs" Link="Infrastructure\CallbackInterceptor.cs" />
<Compile Include="..\Shared\HttpEventSourceListener.cs" Link="Infrastructure\HttpEventSourceListener.cs" />
<Compile Include="..\Shared\Logging\*.cs" LinkBase="Infrastructure\Logging" />
</ItemGroup>

<ItemGroup>
Expand All @@ -38,6 +37,8 @@

<ProjectReference Include="..\..\testassets\FunctionalTestsWebsite\FunctionalTestsWebsite.csproj" />

<PackageReference Include="Microsoft.Extensions.Logging.Testing" />

<None Update="server1.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<Compile Include="..\Shared\TaskExtensions.cs" Link="Infrastructure\TaskExtensions.cs" />
<Compile Include="..\Shared\TestHttpMessageHandler.cs" Link="Infrastructure\TestHttpMessageHandler.cs" />
<Compile Include="..\Shared\TestServerCallContext.cs" Link="Infrastructure\TestServerCallContext.cs" />
<Compile Include="..\Shared\Logging\*.cs" LinkBase="Infrastructure\Logging" />

<ProjectReference Include="..\..\src\Grpc.Core.Api\Grpc.Core.Api.csproj" />
<ProjectReference Include="..\..\src\Grpc.AspNetCore.Server.ClientFactory\Grpc.AspNetCore.Server.ClientFactory.csproj" />

<PackageReference Include="Google.Protobuf" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<Compile Include="..\Shared\TestResponseBodyFeature.cs" Link="Infrastructure\TestResponseBodyFeature.cs" />
<Compile Include="..\Shared\TestServerCallContext.cs" Link="Infrastructure\TestServerCallContext.cs" />
<Compile Include="..\Shared\NUnitLogger.cs" Link="Infrastructure\NUnitLogger.cs" />
<Compile Include="..\Shared\Logging\*.cs" LinkBase="Infrastructure\Logging" />
</ItemGroup>

<ItemGroup>
Expand All @@ -37,6 +36,9 @@
<ProjectReference Include="..\..\src\Grpc.AspNetCore\Grpc.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\Grpc.AspNetCore.HealthChecks\Grpc.AspNetCore.HealthChecks.csproj" />
<ProjectReference Include="..\..\src\Grpc.AspNetCore.Server.Reflection\Grpc.AspNetCore.Server.Reflection.csproj" />

<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 3 additions & 12 deletions test/Grpc.AspNetCore.Server.Tests/GrpcProtocolHelpersTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -30,7 +30,7 @@ public class GrpcProtocolHelpersTests
public void CreateAuthContext_CertWithAlternativeNames_UseAlternativeNamesAsPeerIdentity()
{
// Arrange
var certificate = LoadCertificate(TestHelpers.ResolvePath(@"Certs/outlookcom.crt"));
X509Certificate2 certificate = new X509Certificate2(TestHelpers.ResolvePath(@"Certs/outlookcom.crt"));

// Act
var authContext = GrpcProtocolHelpers.CreateAuthContext(certificate);
Expand All @@ -57,7 +57,7 @@ public void CreateAuthContext_CertWithAlternativeNames_UseAlternativeNamesAsPeer
public void CreateAuthContext_CertWithCommonName_UseCommonNameAsPeerIdentity()
{
// Arrange
var certificate = LoadCertificate(TestHelpers.ResolvePath(@"Certs/client.crt"));
var certificate = new X509Certificate2(TestHelpers.ResolvePath(@"Certs/client.crt"));

// Act
var authContext = GrpcProtocolHelpers.CreateAuthContext(certificate);
Expand Down Expand Up @@ -99,13 +99,4 @@ public void TryDecodeTimeout_WithVariousUnits_ShouldMatchExpected(string timeout
Assert.AreEqual(expectedSuccesfullyDecoded, successfullyDecoded);
Assert.AreEqual(expectedTimespan, timeSpan);
}

public static X509Certificate2 LoadCertificate(string path)
{
#if NET9_0_OR_GREATER
return X509CertificateLoader.LoadCertificateFromFile(path);
#else
return new X509Certificate2(path);
#endif
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand Down Expand Up @@ -537,7 +537,7 @@ public void AuthContext_HasClientCertificate_Authenticated()
{
// Arrange
var httpContext = new DefaultHttpContext();
var certificate = GrpcProtocolHelpersTests.LoadCertificate(TestHelpers.ResolvePath(@"Certs/client.crt"));
var certificate = new X509Certificate2(TestHelpers.ResolvePath(@"Certs/client.crt"));
httpContext.Connection.ClientCertificate = certificate;
var serverCallContext = CreateServerCallContext(httpContext);

Expand Down
2 changes: 1 addition & 1 deletion test/Grpc.Net.Client.Tests/Grpc.Net.Client.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<Compile Include="..\Shared\TestResolver.cs" Link="Infrastructure\Balancer\TestResolver.cs" />
<Compile Include="..\Shared\TestResolverFactory.cs" Link="Infrastructure\Balancer\TestResolverFactory.cs" />
<Compile Include="..\Shared\BalancerWaitHelpers.cs" Link="Infrastructure\Balancer\BalancerWaitHelpers.cs" />
<Compile Include="..\Shared\Logging\*.cs" LinkBase="Infrastructure\Logging" />
</ItemGroup>

<ItemGroup>
Expand All @@ -41,6 +40,7 @@

<PackageReference Include="Google.Protobuf" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<Compile Include="..\Shared\ResponseUtils.cs" Link="Infrastructure\ResponseUtils.cs" />
<Compile Include="..\Shared\TaskExtensions.cs" Link="Infrastructure\TaskExtensions.cs" />
<Compile Include="..\Shared\TestHttpMessageHandler.cs" Link="Infrastructure\TestHttpMessageHandler.cs" />
<Compile Include="..\Shared\Logging\*.cs" LinkBase="Infrastructure\Logging" />

<ProjectReference Include="..\..\src\Grpc.Net.ClientFactory\Grpc.Net.ClientFactory.csproj" />

<PackageReference Include="Google.Protobuf" />
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" />
<PackageReference Include="Microsoft.Extensions.Http" />
</ItemGroup>

Expand Down
14 changes: 0 additions & 14 deletions test/Shared/Logging/BeginScopeContext.cs

This file was deleted.

29 changes: 0 additions & 29 deletions test/Shared/Logging/ITestSink.cs

This file was deleted.

20 changes: 0 additions & 20 deletions test/Shared/Logging/LogLevelAttribute.cs

This file was deleted.

Loading

0 comments on commit bd1b194

Please sign in to comment.