diff --git a/src/Grpc/test/InteropTests/InteropTests.csproj b/src/Grpc/test/InteropTests/InteropTests.csproj index 24d479432b..bcbd1fc4b6 100644 --- a/src/Grpc/test/InteropTests/InteropTests.csproj +++ b/src/Grpc/test/InteropTests/InteropTests.csproj @@ -3,9 +3,6 @@ true $(DefaultNetCoreTargetFramework) - - - false diff --git a/src/Grpc/test/testassets/InteropClient/InteropClient.cs b/src/Grpc/test/testassets/InteropClient/InteropClient.cs index d6b47ab241..91ce761538 100644 --- a/src/Grpc/test/testassets/InteropClient/InteropClient.cs +++ b/src/Grpc/test/testassets/InteropClient/InteropClient.cs @@ -29,7 +29,6 @@ using Google.Apis.Auth.OAuth2; using Google.Protobuf; using Grpc.Auth; using Grpc.Core; -using Grpc.Core.Utils; using Grpc.Net.Client; using Grpc.Testing; using Microsoft.Extensions.DependencyInjection; @@ -96,11 +95,12 @@ namespace InteropTestsClient var services = new ServiceCollection(); services.AddLogging(configure => { - configure.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); - configure.AddSimpleConsole(loggerOptions => + configure.SetMinimumLevel(LogLevel.Trace); + configure.AddConsole(loggerOptions => { +#pragma warning disable CS0618 // Type or member is obsolete loggerOptions.IncludeScopes = true; - loggerOptions.DisableColors = true; +#pragma warning restore CS0618 // Type or member is obsolete }); }); diff --git a/src/Grpc/test/testassets/InteropClient/Program.cs b/src/Grpc/test/testassets/InteropClient/Program.cs index 3fc3d9d975..52eee5640a 100644 --- a/src/Grpc/test/testassets/InteropClient/Program.cs +++ b/src/Grpc/test/testassets/InteropClient/Program.cs @@ -17,6 +17,7 @@ #endregion using System; +using System.Reflection; namespace InteropTestsClient { @@ -26,6 +27,9 @@ namespace InteropTestsClient { Console.WriteLine("Application started."); + var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute()?.InformationalVersion ?? "Unknown"; + Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}"); + InteropClient.Run(args); } } diff --git a/src/Grpc/test/testassets/InteropWebsite/Program.cs b/src/Grpc/test/testassets/InteropWebsite/Program.cs index 3efd0d647c..e160254f5d 100644 --- a/src/Grpc/test/testassets/InteropWebsite/Program.cs +++ b/src/Grpc/test/testassets/InteropWebsite/Program.cs @@ -37,7 +37,7 @@ namespace InteropTestsWebsite Host.CreateDefaultBuilder(args) .ConfigureLogging(builder => { - builder.AddSimpleConsole(o => o.DisableColors = true); + builder.AddConsole(); builder.SetMinimumLevel(LogLevel.Trace); }) .ConfigureWebHostDefaults(webBuilder => diff --git a/src/Grpc/test/testassets/InteropWebsite/Startup.cs b/src/Grpc/test/testassets/InteropWebsite/Startup.cs index 4715d1fbbc..6f335d6c05 100644 --- a/src/Grpc/test/testassets/InteropWebsite/Startup.cs +++ b/src/Grpc/test/testassets/InteropWebsite/Startup.cs @@ -17,6 +17,7 @@ #endregion using System; +using System.Reflection; using Grpc.Testing; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; @@ -37,7 +38,13 @@ namespace InteropTestsWebsite public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime) { // Required to notify test infrastructure that it can begin tests - applicationLifetime.ApplicationStarted.Register(() => Console.WriteLine("Application started.")); + applicationLifetime.ApplicationStarted.Register(() => + { + Console.WriteLine("Application started."); + + var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute()?.InformationalVersion ?? "Unknown"; + Console.WriteLine($"NetCoreAppVersion: {runtimeVersion}"); + }); app.UseRouting(); app.UseEndpoints(endpoints => diff --git a/src/Shared/Process/ProcessEx.cs b/src/Shared/Process/ProcessEx.cs index ad7d06b1ed..e263abb6a2 100644 --- a/src/Shared/Process/ProcessEx.cs +++ b/src/Shared/Process/ProcessEx.cs @@ -218,8 +218,8 @@ namespace Microsoft.AspNetCore.Internal private static string GetNugetPackagesRestorePath() => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_RESTORE"))) ? typeof(ProcessEx).Assembly .GetCustomAttributes() - .First(attribute => attribute.Key == "TestPackageRestorePath") - .Value + .FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath") + ?.Value : Environment.GetEnvironmentVariable("NUGET_RESTORE"); public void Dispose()