Skip to content

Commit

Permalink
Merge pull request dotnet#8422 from dotnet/binding-redirect
Browse files Browse the repository at this point in the history
Update binding redirects for Microsoft.Extensions.* dependencies
  • Loading branch information
maryamariyan authored Mar 15, 2023
2 parents c12b6f3 + 24d5080 commit bf5d35e
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<MicrosoftNetCompilersToolsetVersion>4.6.0-2.23128.3</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>$(RoslynPackageVersion)</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<!-- dotnet/runtime packages -->
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
<MicrosoftExtensionsPackageVersion>7.0.0</MicrosoftExtensionsPackageVersion>
<SystemCollectionsImmutablePackageVersion>6.0.0</SystemCollectionsImmutablePackageVersion>
<SystemCompositionPackageVersion>6.0.0</SystemCompositionPackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>6.0.0</SystemDiagnosticsDiagnosticSourcePackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ public LoggerAdapter(IEnumerable<ILogger> loggers, ITelemetryReporter? telemetry
_telemetryReporter = telemetryReporter;
}

public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
var compositeDisposable = new CompositeDisposable();
foreach (var logger in _loggers)
{
var disposable = logger.BeginScope(state);
compositeDisposable.AddDisposable(disposable);
if (disposable != null)
{
compositeDisposable.AddDisposable(disposable);
}
}

return compositeDisposable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Initialize(ClientNotifierServiceBase serviceBase)
_serviceBase = serviceBase;
}

public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
return new Disposable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public RazorLSPOptionsMonitor(IConfigurationSyncService configurationService, IO

public RazorLSPOptions CurrentValue => Get(Options.DefaultName);

public RazorLSPOptions Get(string name)
public RazorLSPOptions Get(string? name)
{
name ??= Options.DefaultName;
return _cache.GetOrAdd(name, () => _currentValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public LogHubLogger(string categoryName, LogHubLogWriter feedbackFileLogWriter)
_noopScope = new Scope();
}

public IDisposable BeginScope<TState>(TState state) => _noopScope;
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => _noopScope;

public bool IsEnabled(LogLevel logLevel) => true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Dispose()

private class NoopLogger : ILogger
{
public IDisposable BeginScope<TState>(TState state) => Scope.Instance;
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => Scope.Instance;

public bool IsEnabled(LogLevel logLevel) => false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Razor.LanguageServer;
using Microsoft.AspNetCore.Razor.LanguageServer.Common;
using Microsoft.AspNetCore.Razor.Telemetry;
Expand Down Expand Up @@ -259,7 +260,7 @@ private void ConfigureLanguageServer(IServiceCollection serviceCollection)
serviceCollection.AddLogging(logging =>
{
logging.AddFilter<LogHubLoggerProvider>(level => true);
logging.AddProvider(_loggerProvider);
logging.AddProvider(_loggerProvider.AssumeNotNull());
});

if (_vsHostWorkspaceServicesProvider is not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal OutputWindowLogger()
{
}

public IDisposable BeginScope<TState>(TState state) => Scope.Instance;
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => Scope.Instance;

public bool IsEnabled(LogLevel logLevel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,61 @@
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.Logging",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.DependencyInjection",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.DependencyInjection.Abstractions",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.ObjectPool",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.Options",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.Configuration.Abstractions",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.Configuration",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.Extensions.Primitives",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "6.0.0.0",
NewVersion = "6.0.0.0")]
OldVersionUpperBound = "7.0.0.0",
NewVersion = "7.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public TestOutputLogger(
LogLevel = logLevel;
}

public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
=> NoOpDisposable.Instance;

public bool IsEnabled(LogLevel logLevel)
Expand Down

0 comments on commit bf5d35e

Please sign in to comment.