diff --git a/.editorconfig b/.editorconfig
index bf2e10935..688cf0772 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -255,7 +255,7 @@ dotnet_diagnostic.SA1006.severity = error
dotnet_diagnostic.SA1007.severity = error
dotnet_diagnostic.SA1008.severity = error
dotnet_diagnostic.SA1009.severity = error
-dotnet_diagnostic.SA1010.severity = error
+dotnet_diagnostic.SA1010.severity = suggestion
dotnet_diagnostic.SA1011.severity = error
dotnet_diagnostic.SA1012.severity = error
dotnet_diagnostic.SA1013.severity = error
diff --git a/src/Directory.build.props b/src/Directory.build.props
index 221a9b384..c62dbcbd2 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -25,7 +25,8 @@
latestAllEnabledByDefaulttrue
- latest
+ preview
+ $(NoWarn);VSSpell001false
@@ -37,6 +38,9 @@
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+ false
+
@@ -49,7 +53,7 @@
-
+
@@ -58,7 +62,7 @@
-
+
@@ -78,7 +82,7 @@
-
+
diff --git a/src/ReactiveUI.DI.Tests/ReactiveUI.DI.Tests.csproj b/src/ReactiveUI.DI.Tests/ReactiveUI.DI.Tests.csproj
index fecc53449..b4d8e7f9b 100644
--- a/src/ReactiveUI.DI.Tests/ReactiveUI.DI.Tests.csproj
+++ b/src/ReactiveUI.DI.Tests/ReactiveUI.DI.Tests.csproj
@@ -4,7 +4,6 @@
net472;net6.0;$(NoWarn);1591;CA1707;SA1633;CA2000false
- latestenable
diff --git a/src/Splat.AppCenter/AppCenterFeatureUsageTrackingSession.cs b/src/Splat.AppCenter/AppCenterFeatureUsageTrackingSession.cs
index 34b0affd6..699e3d60d 100644
--- a/src/Splat.AppCenter/AppCenterFeatureUsageTrackingSession.cs
+++ b/src/Splat.AppCenter/AppCenterFeatureUsageTrackingSession.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.AppCenter/AppCenterViewTracking.cs b/src/Splat.AppCenter/AppCenterViewTracking.cs
index a7f2abead..aa23a633d 100644
--- a/src/Splat.AppCenter/AppCenterViewTracking.cs
+++ b/src/Splat.AppCenter/AppCenterViewTracking.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.AppCenter/Splat.AppCenter.csproj b/src/Splat.AppCenter/Splat.AppCenter.csproj
index 4dee3d7f7..8e0601246 100644
--- a/src/Splat.AppCenter/Splat.AppCenter.csproj
+++ b/src/Splat.AppCenter/Splat.AppCenter.csproj
@@ -8,7 +8,6 @@
.NET Foundation and ContributorsVisual Studio AppCenter integrations for SplatSplat.AppCenter
- latestenable
diff --git a/src/Splat.ApplicationInsights/ApplicationInsightsFeatureUsageTrackingSession.cs b/src/Splat.ApplicationInsights/ApplicationInsightsFeatureUsageTrackingSession.cs
index f7af82282..dd484f4c3 100644
--- a/src/Splat.ApplicationInsights/ApplicationInsightsFeatureUsageTrackingSession.cs
+++ b/src/Splat.ApplicationInsights/ApplicationInsightsFeatureUsageTrackingSession.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.ApplicationInsights/ApplicationInsightsViewTracking.cs b/src/Splat.ApplicationInsights/ApplicationInsightsViewTracking.cs
index b44d26db1..91d87086c 100644
--- a/src/Splat.ApplicationInsights/ApplicationInsightsViewTracking.cs
+++ b/src/Splat.ApplicationInsights/ApplicationInsightsViewTracking.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -12,15 +12,13 @@ namespace Splat;
///
/// View Tracking integration for Application Insights.
///
-public sealed class ApplicationInsightsViewTracking : IViewTracking
+///
+/// Initializes a new instance of the class.
+///
+/// The Application Insights telemetry client instance to use.
+public sealed class ApplicationInsightsViewTracking(TelemetryClient telemetryClient) : IViewTracking
{
- private readonly TelemetryClient _telemetryClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Application Insights telemetry client instance to use.
- public ApplicationInsightsViewTracking(TelemetryClient telemetryClient) => _telemetryClient = telemetryClient;
+ private readonly TelemetryClient _telemetryClient = telemetryClient;
///
/// Track a view navigation using just a name.
diff --git a/src/Splat.ApplicationInsights/Splat.ApplicationInsights.csproj b/src/Splat.ApplicationInsights/Splat.ApplicationInsights.csproj
index 1e0b69268..3773bc7c3 100644
--- a/src/Splat.ApplicationInsights/Splat.ApplicationInsights.csproj
+++ b/src/Splat.ApplicationInsights/Splat.ApplicationInsights.csproj
@@ -7,7 +7,6 @@
.NET Foundation and ContributorsApplicationInsights integrations for SplatSplat.ApplicationInsights
- latestenable
diff --git a/src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj b/src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj
index 36cf90ea3..248ba3c10 100644
--- a/src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj
+++ b/src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj
@@ -5,7 +5,6 @@
false$(NoWarn);1591;CA1707;SA1633;CA2000
- latestenable
diff --git a/src/Splat.Autofac/AutofacDependencyResolver.cs b/src/Splat.Autofac/AutofacDependencyResolver.cs
index fb655847d..a33d3c211 100644
--- a/src/Splat.Autofac/AutofacDependencyResolver.cs
+++ b/src/Splat.Autofac/AutofacDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Autofac/Splat.Autofac.csproj b/src/Splat.Autofac/Splat.Autofac.csproj
index 9464cf139..c864049b3 100644
--- a/src/Splat.Autofac/Splat.Autofac.csproj
+++ b/src/Splat.Autofac/Splat.Autofac.csproj
@@ -4,7 +4,6 @@
netstandard2.0;net6.0;net7.0$(TargetFrameworks);net462Autofac adapter for Splat
- latestenable
diff --git a/src/Splat.Autofac/SplatAutofacExtensions.cs b/src/Splat.Autofac/SplatAutofacExtensions.cs
index 6211e249f..35fd9a814 100644
--- a/src/Splat.Autofac/SplatAutofacExtensions.cs
+++ b/src/Splat.Autofac/SplatAutofacExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Avalonia.Autofac/AvaloniaMixins.cs b/src/Splat.Avalonia.Autofac/AvaloniaMixins.cs
index 4594fff63..4d7f3f8c2 100644
--- a/src/Splat.Avalonia.Autofac/AvaloniaMixins.cs
+++ b/src/Splat.Avalonia.Autofac/AvaloniaMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs b/src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs
index da7034e85..6927faae7 100644
--- a/src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs
+++ b/src/Splat.Avalonia.DryIoc/AvaloniaMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj b/src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj
index be55d73fd..3323b4b2b 100644
--- a/src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj
+++ b/src/Splat.Avalonia.DryIoc/Splat.Avalonia.DryIoc.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs b/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs
index 93133b30d..b5f221ecf 100644
--- a/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs
+++ b/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/Splat.Avalonia.Microsoft.Extensions.DependencyInjection.csproj b/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/Splat.Avalonia.Microsoft.Extensions.DependencyInjection.csproj
index 4669dd46e..b53bd7935 100644
--- a/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/Splat.Avalonia.Microsoft.Extensions.DependencyInjection.csproj
+++ b/src/Splat.Avalonia.Microsoft.Extensions.DependencyInjection/Splat.Avalonia.Microsoft.Extensions.DependencyInjection.csproj
@@ -2,7 +2,6 @@
netstandard2.0;net6.0;net7.0
- latestenableenable
diff --git a/src/Splat.Avalonia.Ninject/AvaloniaMixins.cs b/src/Splat.Avalonia.Ninject/AvaloniaMixins.cs
index bf2be519e..af53b1ac3 100644
--- a/src/Splat.Avalonia.Ninject/AvaloniaMixins.cs
+++ b/src/Splat.Avalonia.Ninject/AvaloniaMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Avalonia.Tests/Mocks/ViewModels/BarViewModel.cs b/src/Splat.Avalonia.Tests/Mocks/ViewModels/BarViewModel.cs
index fda3d899b..7c6a7b9ba 100644
--- a/src/Splat.Avalonia.Tests/Mocks/ViewModels/BarViewModel.cs
+++ b/src/Splat.Avalonia.Tests/Mocks/ViewModels/BarViewModel.cs
@@ -2,12 +2,10 @@
namespace ReactiveUIDemo.ViewModels
{
- internal class BarViewModel : ReactiveObject, IRoutableViewModel
+ internal class BarViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
{
- public BarViewModel(IScreen screen) => HostScreen = screen;
-
public string UrlPathSegment => "Bar";
- public IScreen HostScreen { get; }
+ public IScreen HostScreen { get; } = screen;
}
}
diff --git a/src/Splat.Avalonia.Tests/Mocks/ViewModels/FooViewModel.cs b/src/Splat.Avalonia.Tests/Mocks/ViewModels/FooViewModel.cs
index 4dd839b2c..b844a584d 100644
--- a/src/Splat.Avalonia.Tests/Mocks/ViewModels/FooViewModel.cs
+++ b/src/Splat.Avalonia.Tests/Mocks/ViewModels/FooViewModel.cs
@@ -2,12 +2,10 @@
namespace ReactiveUIDemo.ViewModels
{
- internal class FooViewModel : ReactiveObject, IRoutableViewModel
+ internal class FooViewModel(IScreen screen) : ReactiveObject, IRoutableViewModel
{
- public FooViewModel(IScreen screen) => HostScreen = screen;
-
public string UrlPathSegment => "Foo";
- public IScreen HostScreen { get; }
+ public IScreen HostScreen { get; } = screen;
}
}
diff --git a/src/Splat.Common.Test/DummyObjectClass1.cs b/src/Splat.Common.Test/DummyObjectClass1.cs
index 50a3ad55d..5348cef78 100644
--- a/src/Splat.Common.Test/DummyObjectClass1.cs
+++ b/src/Splat.Common.Test/DummyObjectClass1.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/DummyObjectClass2.cs b/src/Splat.Common.Test/DummyObjectClass2.cs
index 5802c76fa..9d9411e0f 100644
--- a/src/Splat.Common.Test/DummyObjectClass2.cs
+++ b/src/Splat.Common.Test/DummyObjectClass2.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/DummyObjectClass3.cs b/src/Splat.Common.Test/DummyObjectClass3.cs
index 871cbe7f9..5756ddb1c 100644
--- a/src/Splat.Common.Test/DummyObjectClass3.cs
+++ b/src/Splat.Common.Test/DummyObjectClass3.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/IDummyInterface.cs b/src/Splat.Common.Test/IDummyInterface.cs
index e7bcb2d9f..72e771a08 100644
--- a/src/Splat.Common.Test/IDummyInterface.cs
+++ b/src/Splat.Common.Test/IDummyInterface.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,6 +8,7 @@ namespace Splat.Tests.Mocks;
///
/// A dummy interface used during Locator testing.
///
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "By Design")]
public interface IDummyInterface
{
}
diff --git a/src/Splat.Common.Test/IScreen.cs b/src/Splat.Common.Test/IScreen.cs
index b0522f0f7..4c04892b4 100644
--- a/src/Splat.Common.Test/IScreen.cs
+++ b/src/Splat.Common.Test/IScreen.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,6 +8,7 @@ namespace Splat.Common.Test;
///
/// Represents a screen.
///
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "By Design")]
public interface IScreen
{
}
diff --git a/src/Splat.Common.Test/IViewFor.cs b/src/Splat.Common.Test/IViewFor.cs
index f3c8b6b07..95c14e96d 100644
--- a/src/Splat.Common.Test/IViewFor.cs
+++ b/src/Splat.Common.Test/IViewFor.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/IViewModelOne.cs b/src/Splat.Common.Test/IViewModelOne.cs
index 0a348d5e9..0d8a3815b 100644
--- a/src/Splat.Common.Test/IViewModelOne.cs
+++ b/src/Splat.Common.Test/IViewModelOne.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,6 +8,7 @@ namespace Splat.Common.Test;
///
/// Interface for ViewModelOne.
///
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "By Design")]
public interface IViewModelOne
{
}
diff --git a/src/Splat.Common.Test/MockScreen.cs b/src/Splat.Common.Test/MockScreen.cs
index a99c0e4ed..d0afa95a1 100644
--- a/src/Splat.Common.Test/MockScreen.cs
+++ b/src/Splat.Common.Test/MockScreen.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/Splat.Common.Test.csproj b/src/Splat.Common.Test/Splat.Common.Test.csproj
index 5ba929473..699fd4b95 100644
--- a/src/Splat.Common.Test/Splat.Common.Test.csproj
+++ b/src/Splat.Common.Test/Splat.Common.Test.csproj
@@ -3,7 +3,6 @@
netstandard2.0;net6.0$(NoWarn);CA2000
- latestenable
diff --git a/src/Splat.Common.Test/ViewModelOne.cs b/src/Splat.Common.Test/ViewModelOne.cs
index 1859ce6be..8d5afa875 100644
--- a/src/Splat.Common.Test/ViewModelOne.cs
+++ b/src/Splat.Common.Test/ViewModelOne.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/ViewModelTwo.cs b/src/Splat.Common.Test/ViewModelTwo.cs
index b1daef8cd..a0643bdc8 100644
--- a/src/Splat.Common.Test/ViewModelTwo.cs
+++ b/src/Splat.Common.Test/ViewModelTwo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/ViewOne.cs b/src/Splat.Common.Test/ViewOne.cs
index 5a0ef942c..e0a6eb850 100644
--- a/src/Splat.Common.Test/ViewOne.cs
+++ b/src/Splat.Common.Test/ViewOne.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/ViewThatShouldNotLoad.cs b/src/Splat.Common.Test/ViewThatShouldNotLoad.cs
index 5f041f4f1..420980a77 100644
--- a/src/Splat.Common.Test/ViewThatShouldNotLoad.cs
+++ b/src/Splat.Common.Test/ViewThatShouldNotLoad.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Common.Test/ViewTwo.cs b/src/Splat.Common.Test/ViewTwo.cs
index 743f8c184..c7c073eef 100644
--- a/src/Splat.Common.Test/ViewTwo.cs
+++ b/src/Splat.Common.Test/ViewTwo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing.Tests/BitmapLoaderTests.cs b/src/Splat.Drawing.Tests/BitmapLoaderTests.cs
index 1761ecd58..b2c61d30c 100644
--- a/src/Splat.Drawing.Tests/BitmapLoaderTests.cs
+++ b/src/Splat.Drawing.Tests/BitmapLoaderTests.cs
@@ -17,12 +17,12 @@ public sealed class BitmapLoaderTests
///
/// Gets the test data for the Load Suceeds Unit Test.
///
- public static TheoryData> LoadSucceedsTestData { get; } = new()
- {
+ public static TheoryData> LoadSucceedsTestData { get; } =
+ [
GetPngStream,
GetJpegStream,
GetBitmapStream,
- };
+ ];
///
/// Test to ensure the bitmap loader initializes properly.
diff --git a/src/Splat.Drawing.Tests/Splat.Drawing.Tests.csproj b/src/Splat.Drawing.Tests/Splat.Drawing.Tests.csproj
index ad9abcf88..cc7f68e21 100644
--- a/src/Splat.Drawing.Tests/Splat.Drawing.Tests.csproj
+++ b/src/Splat.Drawing.Tests/Splat.Drawing.Tests.csproj
@@ -4,7 +4,6 @@
net6.0-windowsfalse$(NoWarn);1591;CA1707;SA1633;CA2000;CA1034
- latestenable
diff --git a/src/Splat.Drawing/Bitmaps/BitmapLoader.cs b/src/Splat.Drawing/Bitmaps/BitmapLoader.cs
index 74510d3a5..51b2ecad5 100644
--- a/src/Splat.Drawing/Bitmaps/BitmapLoader.cs
+++ b/src/Splat.Drawing/Bitmaps/BitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Bitmaps/BitmapLoaderException.cs b/src/Splat.Drawing/Bitmaps/BitmapLoaderException.cs
index c3859774c..192d4c734 100644
--- a/src/Splat.Drawing/Bitmaps/BitmapLoaderException.cs
+++ b/src/Splat.Drawing/Bitmaps/BitmapLoaderException.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Bitmaps/CompressedBitmapFormat.cs b/src/Splat.Drawing/Bitmaps/CompressedBitmapFormat.cs
index 6636db080..6d88febb2 100644
--- a/src/Splat.Drawing/Bitmaps/CompressedBitmapFormat.cs
+++ b/src/Splat.Drawing/Bitmaps/CompressedBitmapFormat.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Bitmaps/IBitmap.cs b/src/Splat.Drawing/Bitmaps/IBitmap.cs
index 5a74d31aa..a4dfd2a72 100644
--- a/src/Splat.Drawing/Bitmaps/IBitmap.cs
+++ b/src/Splat.Drawing/Bitmaps/IBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Bitmaps/IBitmapLoader.cs b/src/Splat.Drawing/Bitmaps/IBitmapLoader.cs
index a9585733e..8f3bd8cab 100644
--- a/src/Splat.Drawing/Bitmaps/IBitmapLoader.cs
+++ b/src/Splat.Drawing/Bitmaps/IBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Colors/SplatColor.KnownColors.cs b/src/Splat.Drawing/Colors/SplatColor.KnownColors.cs
index 982e9044a..5ea424aef 100644
--- a/src/Splat.Drawing/Colors/SplatColor.KnownColors.cs
+++ b/src/Splat.Drawing/Colors/SplatColor.KnownColors.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Colors/SplatColor.cs b/src/Splat.Drawing/Colors/SplatColor.cs
index 5fd7b7fa7..cac0e94e5 100644
--- a/src/Splat.Drawing/Colors/SplatColor.cs
+++ b/src/Splat.Drawing/Colors/SplatColor.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -244,6 +244,7 @@ public static SplatColor FromKnownColor(KnownColor color)
/// The generated SplatValue.
public static SplatColor FromName(string name)
{
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
KnownColor kc = (KnownColor)Enum.Parse(typeof(KnownColor), name, true);
@@ -259,6 +260,7 @@ public static SplatColor FromName(string name)
d._state |= (short)ColorType.Named;
return d;
}
+#pragma warning restore CA1031 // Do not catch general exception types
}
///
@@ -438,6 +440,7 @@ private static void CheckARGBValues(int alpha, int red, int green, int blue)
private static SplatColor CheckIfIsKnownColor(SplatColor splatColor)
{
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
var index = Array.IndexOf(KnownColors.ArgbValues, splatColor.Value);
@@ -450,6 +453,7 @@ private static SplatColor CheckIfIsKnownColor(SplatColor splatColor)
catch
{
}
+#pragma warning restore CA1031 // Do not catch general exception types
return splatColor;
}
diff --git a/src/Splat.Drawing/DefaultPlatformModeDetector.cs b/src/Splat.Drawing/DefaultPlatformModeDetector.cs
index 8ab1ea851..721e5f4b8 100644
--- a/src/Splat.Drawing/DefaultPlatformModeDetector.cs
+++ b/src/Splat.Drawing/DefaultPlatformModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/IPlatformModeDetector.cs b/src/Splat.Drawing/IPlatformModeDetector.cs
index 1927961bb..a13fbe614 100644
--- a/src/Splat.Drawing/IPlatformModeDetector.cs
+++ b/src/Splat.Drawing/IPlatformModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/PlatformModeDetector.cs b/src/Splat.Drawing/PlatformModeDetector.cs
index cbecce76e..4337053a2 100644
--- a/src/Splat.Drawing/PlatformModeDetector.cs
+++ b/src/Splat.Drawing/PlatformModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Android/Bitmaps/AndroidBitmap.cs b/src/Splat.Drawing/Platforms/Android/Bitmaps/AndroidBitmap.cs
index 35f1a0503..bd4032a7c 100644
--- a/src/Splat.Drawing/Platforms/Android/Bitmaps/AndroidBitmap.cs
+++ b/src/Splat.Drawing/Platforms/Android/Bitmaps/AndroidBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -10,15 +10,14 @@ namespace Splat;
///
/// Wraps a android native bitmap into the splat .
///
-internal sealed class AndroidBitmap : IBitmap
+///
+/// Initializes a new instance of the class.
+///
+/// The bitmap we are wrapping.
+internal sealed class AndroidBitmap(Bitmap inner) : IBitmap
{
- private Bitmap? _inner;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The bitmap we are wrapping.
- public AndroidBitmap(Bitmap inner) => _inner = inner;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Is Disposed using Interlocked method")]
+ private Bitmap? _inner = inner;
///
public float Width => _inner?.Width ?? 0;
diff --git a/src/Splat.Drawing/Platforms/Android/Bitmaps/BitmapMixins.cs b/src/Splat.Drawing/Platforms/Android/Bitmaps/BitmapMixins.cs
index 3e977c476..7d7419eea 100644
--- a/src/Splat.Drawing/Platforms/Android/Bitmaps/BitmapMixins.cs
+++ b/src/Splat.Drawing/Platforms/Android/Bitmaps/BitmapMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Android/Bitmaps/DrawableBitmap.cs b/src/Splat.Drawing/Platforms/Android/Bitmaps/DrawableBitmap.cs
index 9347439ad..a1bc8d0fe 100644
--- a/src/Splat.Drawing/Platforms/Android/Bitmaps/DrawableBitmap.cs
+++ b/src/Splat.Drawing/Platforms/Android/Bitmaps/DrawableBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -7,15 +7,14 @@
namespace Splat;
-internal sealed class DrawableBitmap : IBitmap
+///
+/// Initializes a new instance of the class.
+///
+/// The drawable bitmap to wrap.
+internal sealed class DrawableBitmap(Drawable inner) : IBitmap
{
- private Drawable? _inner;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The drawable bitmap to wrap.
- public DrawableBitmap(Drawable inner) => _inner = inner;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Is Disposed using Interlocked method")]
+ private Drawable? _inner = inner;
///
public float Width => Inner.IntrinsicWidth;
diff --git a/src/Splat.Drawing/Platforms/Android/Bitmaps/PlatformBitmapLoader.cs b/src/Splat.Drawing/Platforms/Android/Bitmaps/PlatformBitmapLoader.cs
index dd0b92161..0194cde91 100644
--- a/src/Splat.Drawing/Platforms/Android/Bitmaps/PlatformBitmapLoader.cs
+++ b/src/Splat.Drawing/Platforms/Android/Bitmaps/PlatformBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -57,16 +57,15 @@ public class PlatformBitmapLoader : IBitmapLoader, IEnableLogger
OutHeight = (int)desiredHeight.Value,
};
- var noPadding = new Rect(0, 0, 0, 0);
+ using var noPadding = new Rect(0, 0, 0, 0);
bitmap = await Task.Run(() => BitmapFactory.DecodeStream(sourceStream, noPadding, opts)).ConfigureAwait(true);
}
- if (bitmap is null)
+ return bitmap switch
{
- throw new IOException("Failed to load bitmap from source stream");
- }
-
- return bitmap.FromNative();
+ null => throw new IOException("Failed to load bitmap from source stream"),
+ _ => bitmap.FromNative()
+ };
}
///
@@ -85,26 +84,22 @@ public class PlatformBitmapLoader : IBitmapLoader, IEnableLogger
throw new InvalidOperationException("No resources found in the application.");
}
- var id = default(int);
- if (int.TryParse(source, out id))
+ if (int.TryParse(source, out var id))
{
return Task.Run(() => GetFromDrawable(res.GetDrawable(id, theme)));
}
- if (_drawableList.ContainsKey(source))
+ if (_drawableList.TryGetValue(source, out var value))
{
- return Task.Run(() => GetFromDrawable(res.GetDrawable(_drawableList[source], theme)));
+ return Task.Run(() => GetFromDrawable(res.GetDrawable(value, theme)));
}
// NB: On iOS, you have to pass the extension, but on Android it's
// stripped - try stripping the extension to see if there's a Drawable.
var key = System.IO.Path.GetFileNameWithoutExtension(source);
- if (_drawableList.ContainsKey(key))
- {
- return Task.Run(() => GetFromDrawable(res.GetDrawable(_drawableList[key], theme)));
- }
-
- throw new ArgumentException("Either pass in an integer ID cast to a string, or the name of a drawable resource");
+ return _drawableList.TryGetValue(key, out var intValue)
+ ? Task.Run(() => GetFromDrawable(res.GetDrawable(intValue, theme)))
+ : throw new ArgumentException("Either pass in an integer ID cast to a string, or the name of a drawable resource");
}
///
diff --git a/src/Splat.Drawing/Platforms/Android/Colors/ColorExtensions.cs b/src/Splat.Drawing/Platforms/Android/Colors/ColorExtensions.cs
index 8abd1ed26..6dcf3434e 100644
--- a/src/Splat.Drawing/Platforms/Android/Colors/ColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/Android/Colors/ColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Android/Colors/SplatColorExtensions.cs b/src/Splat.Drawing/Platforms/Android/Colors/SplatColorExtensions.cs
index 9f6b4847b..47247c2b2 100644
--- a/src/Splat.Drawing/Platforms/Android/Colors/SplatColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/Android/Colors/SplatColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Android/Maths/PointExtensions.cs b/src/Splat.Drawing/Platforms/Android/Maths/PointExtensions.cs
index 0bbb8d34e..f52bab739 100644
--- a/src/Splat.Drawing/Platforms/Android/Maths/PointExtensions.cs
+++ b/src/Splat.Drawing/Platforms/Android/Maths/PointExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Android/Maths/RectExtensions.cs b/src/Splat.Drawing/Platforms/Android/Maths/RectExtensions.cs
index 98b75c918..60c56432e 100644
--- a/src/Splat.Drawing/Platforms/Android/Maths/RectExtensions.cs
+++ b/src/Splat.Drawing/Platforms/Android/Maths/RectExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/BitmapMixins.cs b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/BitmapMixins.cs
index ddcf3a356..17e8aa6b2 100644
--- a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/BitmapMixins.cs
+++ b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/BitmapMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/CocoaBitmap.cs b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/CocoaBitmap.cs
index cae25d563..f2776d9df 100644
--- a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/CocoaBitmap.cs
+++ b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/CocoaBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -20,15 +20,14 @@ namespace Splat;
///
/// Wraps a cocoa native bitmap into the splat .
///
-internal sealed class CocoaBitmap : IBitmap
+///
+/// Initializes a new instance of the class.
+///
+/// The native image we are wrapping.
+internal sealed class CocoaBitmap(UIImage inner) : IBitmap
{
- private UIImage? _inner;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The native image we are wrapping.
- public CocoaBitmap(UIImage inner) => _inner = inner;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Disposed in a Interlocked method")]
+ private UIImage? _inner = inner;
///
public float Width => (float)(_inner?.Size.Width ?? 0);
diff --git a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/PlatformBitmapLoader.cs b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/PlatformBitmapLoader.cs
index d316d7ba5..cf467f4a6 100644
--- a/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/PlatformBitmapLoader.cs
+++ b/src/Splat.Drawing/Platforms/Cocoa/Bitmaps/PlatformBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -30,6 +30,7 @@ public class PlatformBitmapLoader : IBitmapLoader
#if UIKIT
NSRunLoop.InvokeInBackground(() =>
{
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
if (data is null)
@@ -42,9 +43,10 @@ public class PlatformBitmapLoader : IBitmapLoader
}
catch (Exception ex)
{
- LogHost.Default.Debug(ex, "Unable to parse bitmap from byte stream.");
+ LogHost.Default.Debug(ex.ToString(), "Unable to parse bitmap from byte stream.");
tcs.TrySetException(ex);
}
+#pragma warning restore CA1031 // Do not catch general exception types
});
#else
@@ -75,6 +77,7 @@ public class PlatformBitmapLoader : IBitmapLoader
#if UIKIT
NSRunLoop.InvokeInBackground(() =>
{
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
var bitmap = UIImage.FromBundle(source) ?? throw new InvalidOperationException("Failed to load image from resource: " + source);
@@ -82,9 +85,10 @@ public class PlatformBitmapLoader : IBitmapLoader
}
catch (Exception ex)
{
- LogHost.Default.Debug(ex, "Unable to parse bitmap from resource.");
+ LogHost.Default.Debug(ex.ToString(), "Unable to parse bitmap from resource.");
tcs.TrySetException(ex);
}
+#pragma warning restore CA1031 // Do not catch general exception types
});
#else
NSRunLoop.Main.BeginInvokeOnMainThread(() =>
diff --git a/src/Splat.Drawing/Platforms/Cocoa/Colors/SplatColorExtensions.cs b/src/Splat.Drawing/Platforms/Cocoa/Colors/SplatColorExtensions.cs
index 63d3955df..4b2f3fcb0 100644
--- a/src/Splat.Drawing/Platforms/Cocoa/Colors/SplatColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/Cocoa/Colors/SplatColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/ReflectionStubs.cs b/src/Splat.Drawing/Platforms/ReflectionStubs.cs
index b19b16369..495330e37 100644
--- a/src/Splat.Drawing/Platforms/ReflectionStubs.cs
+++ b/src/Splat.Drawing/Platforms/ReflectionStubs.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/ServiceLocationDrawingInitialization.cs b/src/Splat.Drawing/Platforms/ServiceLocationDrawingInitialization.cs
index e16de1883..169f938e0 100644
--- a/src/Splat.Drawing/Platforms/ServiceLocationDrawingInitialization.cs
+++ b/src/Splat.Drawing/Platforms/ServiceLocationDrawingInitialization.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/BitmapMixins.cs b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/BitmapMixins.cs
index 1cae91cef..c93c91a01 100644
--- a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/BitmapMixins.cs
+++ b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/BitmapMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/PlatformBitmapLoader.cs b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/PlatformBitmapLoader.cs
index e8366fe6a..3c1859d6b 100644
--- a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/PlatformBitmapLoader.cs
+++ b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/PlatformBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/TizenBitmap.cs b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/TizenBitmap.cs
index 81709550d..658f0fc50 100644
--- a/src/Splat.Drawing/Platforms/Tizen/Bitmaps/TizenBitmap.cs
+++ b/src/Splat.Drawing/Platforms/Tizen/Bitmaps/TizenBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/TypeForwardedSystemDrawing.cs b/src/Splat.Drawing/Platforms/TypeForwardedSystemDrawing.cs
index 11594f75d..73e526bc8 100644
--- a/src/Splat.Drawing/Platforms/TypeForwardedSystemDrawing.cs
+++ b/src/Splat.Drawing/Platforms/TypeForwardedSystemDrawing.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapMixins.cs b/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapMixins.cs
index aaf534131..422a445aa 100644
--- a/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapMixins.cs
+++ b/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapSourceBitmap.cs b/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapSourceBitmap.cs
index 41cf9bd45..72784db29 100644
--- a/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapSourceBitmap.cs
+++ b/src/Splat.Drawing/Platforms/net4/Bitmaps/BitmapSourceBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -11,14 +11,12 @@ namespace Splat;
///
/// A bitmap that wraps a .
///
-internal sealed class BitmapSourceBitmap : IBitmap
+///
+/// Initializes a new instance of the class.
+///
+/// The platform native bitmap we are wrapping.
+internal sealed class BitmapSourceBitmap(BitmapSource bitmap) : IBitmap
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The platform native bitmap we are wrapping.
- public BitmapSourceBitmap(BitmapSource bitmap) => Inner = bitmap;
-
///
public float Width => (float)(Inner?.Width ?? 0f);
@@ -28,7 +26,7 @@ internal sealed class BitmapSourceBitmap : IBitmap
///
/// Gets the platform .
///
- public BitmapSource? Inner { get; private set; }
+ public BitmapSource? Inner { get; private set; } = bitmap;
///
public Task Save(CompressedBitmapFormat format, float quality, Stream target)
diff --git a/src/Splat.Drawing/Platforms/net4/Bitmaps/PlatformBitmapLoader.cs b/src/Splat.Drawing/Platforms/net4/Bitmaps/PlatformBitmapLoader.cs
index f87d6eefd..c829c6245 100644
--- a/src/Splat.Drawing/Platforms/net4/Bitmaps/PlatformBitmapLoader.cs
+++ b/src/Splat.Drawing/Platforms/net4/Bitmaps/PlatformBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Colors/ColorExtensions.cs b/src/Splat.Drawing/Platforms/net4/Colors/ColorExtensions.cs
index 44696c2a2..4036920ca 100644
--- a/src/Splat.Drawing/Platforms/net4/Colors/ColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net4/Colors/ColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Colors/SplatColorExtensions.cs b/src/Splat.Drawing/Platforms/net4/Colors/SplatColorExtensions.cs
index 2eb14f676..bd50a5a7d 100644
--- a/src/Splat.Drawing/Platforms/net4/Colors/SplatColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net4/Colors/SplatColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Maths/PointExtensions.cs b/src/Splat.Drawing/Platforms/net4/Maths/PointExtensions.cs
index fb6aa2053..c5487962c 100644
--- a/src/Splat.Drawing/Platforms/net4/Maths/PointExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net4/Maths/PointExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Maths/RectExtensions.cs b/src/Splat.Drawing/Platforms/net4/Maths/RectExtensions.cs
index 0661bc1a3..4fefc5d4c 100644
--- a/src/Splat.Drawing/Platforms/net4/Maths/RectExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net4/Maths/RectExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net4/Maths/SizeExtensions.cs b/src/Splat.Drawing/Platforms/net4/Maths/SizeExtensions.cs
index 180d4c212..e21bcf043 100644
--- a/src/Splat.Drawing/Platforms/net4/Maths/SizeExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net4/Maths/SizeExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapMixins.cs b/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapMixins.cs
index dd932ddb7..c330c497e 100644
--- a/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapMixins.cs
+++ b/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapSourceBitmap.cs b/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapSourceBitmap.cs
index 83c8777eb..becba92e2 100644
--- a/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapSourceBitmap.cs
+++ b/src/Splat.Drawing/Platforms/net6/Bitmaps/BitmapSourceBitmap.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -11,14 +11,12 @@ namespace Splat;
///
/// A bitmap that wraps a .
///
-internal sealed class BitmapSourceBitmap : IBitmap
+///
+/// Initializes a new instance of the class.
+///
+/// The platform native bitmap we are wrapping.
+internal sealed class BitmapSourceBitmap(BitmapSource bitmap) : IBitmap
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The platform native bitmap we are wrapping.
- public BitmapSourceBitmap(BitmapSource bitmap) => Inner = bitmap;
-
///
public float Width => (float)(Inner?.Width ?? 0);
@@ -28,26 +26,22 @@ internal sealed class BitmapSourceBitmap : IBitmap
///
/// Gets the platform .
///
- public BitmapSource? Inner { get; private set; }
+ public BitmapSource? Inner { get; private set; } = bitmap;
///
- public Task Save(CompressedBitmapFormat format, float quality, Stream target)
+ public Task Save(CompressedBitmapFormat format, float quality, Stream target) => target switch
+ {
+ null => throw new ArgumentNullException(nameof(target)),
+ _ => Task.Run(() =>
{
- if (target is null)
- {
- throw new ArgumentNullException(nameof(target));
- }
-
- return Task.Run(() =>
- {
- var encoder = format == CompressedBitmapFormat.Jpeg ?
- new JpegBitmapEncoder { QualityLevel = (int)(quality * 100.0f) } :
- (BitmapEncoder)new PngBitmapEncoder();
-
- encoder.Frames.Add(BitmapFrame.Create(Inner));
- encoder.Save(target);
- });
- }
+ var encoder = format == CompressedBitmapFormat.Jpeg ?
+ new JpegBitmapEncoder { QualityLevel = (int)(quality * 100.0f) } :
+ (BitmapEncoder)new PngBitmapEncoder();
+
+ encoder.Frames.Add(BitmapFrame.Create(Inner));
+ encoder.Save(target);
+ })
+ };
///
public void Dispose() => Inner = null;
diff --git a/src/Splat.Drawing/Platforms/net6/Bitmaps/PlatformBitmapLoader.cs b/src/Splat.Drawing/Platforms/net6/Bitmaps/PlatformBitmapLoader.cs
index fdc7e1ed6..a47555395 100644
--- a/src/Splat.Drawing/Platforms/net6/Bitmaps/PlatformBitmapLoader.cs
+++ b/src/Splat.Drawing/Platforms/net6/Bitmaps/PlatformBitmapLoader.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Colors/ColorExtensions.cs b/src/Splat.Drawing/Platforms/net6/Colors/ColorExtensions.cs
index 44696c2a2..4036920ca 100644
--- a/src/Splat.Drawing/Platforms/net6/Colors/ColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net6/Colors/ColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Colors/SplatColorExtensions.cs b/src/Splat.Drawing/Platforms/net6/Colors/SplatColorExtensions.cs
index 2eb14f676..bd50a5a7d 100644
--- a/src/Splat.Drawing/Platforms/net6/Colors/SplatColorExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net6/Colors/SplatColorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Maths/PointExtensions.cs b/src/Splat.Drawing/Platforms/net6/Maths/PointExtensions.cs
index fb6aa2053..c5487962c 100644
--- a/src/Splat.Drawing/Platforms/net6/Maths/PointExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net6/Maths/PointExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Maths/RectExtensions.cs b/src/Splat.Drawing/Platforms/net6/Maths/RectExtensions.cs
index 0661bc1a3..4fefc5d4c 100644
--- a/src/Splat.Drawing/Platforms/net6/Maths/RectExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net6/Maths/RectExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Platforms/net6/Maths/SizeExtensions.cs b/src/Splat.Drawing/Platforms/net6/Maths/SizeExtensions.cs
index 180d4c212..e21bcf043 100644
--- a/src/Splat.Drawing/Platforms/net6/Maths/SizeExtensions.cs
+++ b/src/Splat.Drawing/Platforms/net6/Maths/SizeExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Properties/AssemblyInfo.cs b/src/Splat.Drawing/Properties/AssemblyInfo.cs
index 79e93dd42..7c59bd4d1 100644
--- a/src/Splat.Drawing/Properties/AssemblyInfo.cs
+++ b/src/Splat.Drawing/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Drawing/Splat.Drawing.csproj b/src/Splat.Drawing/Splat.Drawing.csproj
index 9dd17dfaf..21ef5a47c 100644
--- a/src/Splat.Drawing/Splat.Drawing.csproj
+++ b/src/Splat.Drawing/Splat.Drawing.csproj
@@ -8,7 +8,6 @@
A library to make things cross-platform that should beSplat.Drawing$(NoWarn);1591
- latestenable
diff --git a/src/Splat.DryIoc.Tests/Splat.DryIoc.Tests.csproj b/src/Splat.DryIoc.Tests/Splat.DryIoc.Tests.csproj
index 9a2992410..0095b9d06 100644
--- a/src/Splat.DryIoc.Tests/Splat.DryIoc.Tests.csproj
+++ b/src/Splat.DryIoc.Tests/Splat.DryIoc.Tests.csproj
@@ -3,7 +3,6 @@
net6.0$(NoWarn);1591;CA1707;SA1633;CA2000
- latestenable
diff --git a/src/Splat.DryIoc/DryIocDependencyResolver.cs b/src/Splat.DryIoc/DryIocDependencyResolver.cs
index ab68261e6..eb4a19c2b 100644
--- a/src/Splat.DryIoc/DryIocDependencyResolver.cs
+++ b/src/Splat.DryIoc/DryIocDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -14,15 +14,13 @@ namespace Splat.DryIoc;
/// https://bitbucket.org/dadhi/dryioc/wiki/Home.
///
///
-public class DryIocDependencyResolver : IDependencyResolver
+///
+/// Initializes a new instance of the class.
+///
+/// The container.
+public class DryIocDependencyResolver(IContainer? container = null) : IDependencyResolver
{
- private readonly IContainer _container;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The container.
- public DryIocDependencyResolver(IContainer? container = null) => _container = container ?? new Container();
+ private readonly IContainer _container = container ?? new Container();
///
public virtual object? GetService(Type? serviceType, string? contract = null) =>
diff --git a/src/Splat.DryIoc/Splat.DryIoc.csproj b/src/Splat.DryIoc/Splat.DryIoc.csproj
index b0eb034c6..89f808088 100644
--- a/src/Splat.DryIoc/Splat.DryIoc.csproj
+++ b/src/Splat.DryIoc/Splat.DryIoc.csproj
@@ -4,12 +4,11 @@
$(TargetFrameworks);net462$(NoWarn);CA1801DryIoc adapter for Splat
- latestenable
-
+
diff --git a/src/Splat.DryIoc/SplatDryIocExtensions.cs b/src/Splat.DryIoc/SplatDryIocExtensions.cs
index 9385ebe24..cf9ac2ec2 100644
--- a/src/Splat.DryIoc/SplatDryIocExtensions.cs
+++ b/src/Splat.DryIoc/SplatDryIocExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Exceptionless/ExceptionlessFeatureUsageTrackingSession.cs b/src/Splat.Exceptionless/ExceptionlessFeatureUsageTrackingSession.cs
index 5c6e941a7..160e3e868 100644
--- a/src/Splat.Exceptionless/ExceptionlessFeatureUsageTrackingSession.cs
+++ b/src/Splat.Exceptionless/ExceptionlessFeatureUsageTrackingSession.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Exceptionless/ExceptionlessSplatLogger.cs b/src/Splat.Exceptionless/ExceptionlessSplatLogger.cs
index c04603967..b4ede36f8 100644
--- a/src/Splat.Exceptionless/ExceptionlessSplatLogger.cs
+++ b/src/Splat.Exceptionless/ExceptionlessSplatLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Exceptionless/ExceptionlessViewTracking.cs b/src/Splat.Exceptionless/ExceptionlessViewTracking.cs
index 5804baeaa..79c1c5465 100644
--- a/src/Splat.Exceptionless/ExceptionlessViewTracking.cs
+++ b/src/Splat.Exceptionless/ExceptionlessViewTracking.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -12,15 +12,13 @@ namespace Splat;
///
/// Exceptionless View Tracking integration.
///
-public sealed class ExceptionlessViewTracking : IViewTracking
+///
+/// Initializes a new instance of the class.
+///
+/// The exceptionless client to use.
+public sealed class ExceptionlessViewTracking(ExceptionlessClient exceptionlessClient) : IViewTracking
{
- private readonly ExceptionlessClient _exceptionlessClient;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The exceptionless client to use.
- public ExceptionlessViewTracking(ExceptionlessClient exceptionlessClient) => _exceptionlessClient = exceptionlessClient ?? throw new ArgumentNullException(nameof(exceptionlessClient));
+ private readonly ExceptionlessClient _exceptionlessClient = exceptionlessClient ?? throw new ArgumentNullException(nameof(exceptionlessClient));
///
/// Track a view navigation using just a name.
diff --git a/src/Splat.Exceptionless/MutableDependencyResolverExtensions.cs b/src/Splat.Exceptionless/MutableDependencyResolverExtensions.cs
index bba38b1c1..b2c3af429 100644
--- a/src/Splat.Exceptionless/MutableDependencyResolverExtensions.cs
+++ b/src/Splat.Exceptionless/MutableDependencyResolverExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Exceptionless/Splat.Exceptionless.csproj b/src/Splat.Exceptionless/Splat.Exceptionless.csproj
index 22ac99f0b..1f2abac40 100644
--- a/src/Splat.Exceptionless/Splat.Exceptionless.csproj
+++ b/src/Splat.Exceptionless/Splat.Exceptionless.csproj
@@ -7,11 +7,10 @@
.NET Foundation and ContributorsExceptionless integrations for SplatSplat.Exceptionless
- latestenable
-
+
diff --git a/src/Splat.Log4Net/Log4NetLogger.cs b/src/Splat.Log4Net/Log4NetLogger.cs
index b88abe920..49cd33756 100644
--- a/src/Splat.Log4Net/Log4NetLogger.cs
+++ b/src/Splat.Log4Net/Log4NetLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Log4Net/LogResolver.cs b/src/Splat.Log4Net/LogResolver.cs
index ae42c3bf6..c0414cad1 100644
--- a/src/Splat.Log4Net/LogResolver.cs
+++ b/src/Splat.Log4Net/LogResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Log4Net/MutableDependencyResolverExtensions.cs b/src/Splat.Log4Net/MutableDependencyResolverExtensions.cs
index ee9f6ef4b..4ec455360 100644
--- a/src/Splat.Log4Net/MutableDependencyResolverExtensions.cs
+++ b/src/Splat.Log4Net/MutableDependencyResolverExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Log4Net/Properties/AssemblyInfo.cs b/src/Splat.Log4Net/Properties/AssemblyInfo.cs
index e6519b716..2458b8be4 100644
--- a/src/Splat.Log4Net/Properties/AssemblyInfo.cs
+++ b/src/Splat.Log4Net/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.Log4Net/Splat.Log4Net.csproj b/src/Splat.Log4Net/Splat.Log4Net.csproj
index b5157d7f1..3b3c5834a 100644
--- a/src/Splat.Log4Net/Splat.Log4Net.csproj
+++ b/src/Splat.Log4Net/Splat.Log4Net.csproj
@@ -7,7 +7,6 @@
.NET Foundation and ContributorsLog4Net integrations for SplatSplat.Log4Net
- latestenable
diff --git a/src/Splat.Microsoft.Extensions.DependencyInjection.Tests/Splat.Microsoft.Extensions.DependencyInjection.Tests.csproj b/src/Splat.Microsoft.Extensions.DependencyInjection.Tests/Splat.Microsoft.Extensions.DependencyInjection.Tests.csproj
index cad328aa3..e6117b078 100644
--- a/src/Splat.Microsoft.Extensions.DependencyInjection.Tests/Splat.Microsoft.Extensions.DependencyInjection.Tests.csproj
+++ b/src/Splat.Microsoft.Extensions.DependencyInjection.Tests/Splat.Microsoft.Extensions.DependencyInjection.Tests.csproj
@@ -4,7 +4,6 @@
net6.0$(NoWarn);1591;CA1707;SA1633;CA2000false
- latestenable
diff --git a/src/Splat.Microsoft.Extensions.DependencyInjection/MicrosoftDependencyResolver.cs b/src/Splat.Microsoft.Extensions.DependencyInjection/MicrosoftDependencyResolver.cs
index 9563d46f4..692d1ca62 100644
--- a/src/Splat.Microsoft.Extensions.DependencyInjection/MicrosoftDependencyResolver.cs
+++ b/src/Splat.Microsoft.Extensions.DependencyInjection/MicrosoftDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -363,12 +363,12 @@ public bool TryRemoveContract(string contract) =>
public void AddFactory(string contract, Func
///
-public class NinjectDependencyResolver : IDependencyResolver
+///
+/// Initializes a new instance of the class.
+///
+/// The kernel.
+public class NinjectDependencyResolver(IKernel kernel) : IDependencyResolver
{
- private readonly IKernel _kernel;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The kernel.
- public NinjectDependencyResolver(IKernel kernel) => _kernel = kernel;
+ private readonly IKernel _kernel = kernel;
///
public virtual object? GetService(Type? serviceType, string? contract = null) =>
@@ -33,6 +31,7 @@ public virtual IEnumerable
public Dictionary>> RegisteredFactories { get; }
- = new();
+ = [];
///
public object? GetService(Type? serviceType, string? contract = null)
@@ -64,7 +64,7 @@ public void Register(Func factory, Type? serviceType, string? contract
{
if (!RegisteredFactories.ContainsKey(serviceType))
{
- RegisteredFactories.Add(serviceType, new());
+ RegisteredFactories.Add(serviceType, []);
}
RegisteredFactories[serviceType].Add(() =>
diff --git a/src/Splat.SimpleInjector/Splat.SimpleInjector.csproj b/src/Splat.SimpleInjector/Splat.SimpleInjector.csproj
index 91a96fc35..e0cf9c768 100644
--- a/src/Splat.SimpleInjector/Splat.SimpleInjector.csproj
+++ b/src/Splat.SimpleInjector/Splat.SimpleInjector.csproj
@@ -4,7 +4,6 @@
netstandard2.0;net6.0;net7.0$(TargetFrameworks);net462SimpleInjector adapter for Splat
- latestenable
diff --git a/src/Splat.SimpleInjector/SplatSimpleInjectorExtensions.cs b/src/Splat.SimpleInjector/SplatSimpleInjectorExtensions.cs
index 17bb87cd8..92cc4deeb 100644
--- a/src/Splat.SimpleInjector/SplatSimpleInjectorExtensions.cs
+++ b/src/Splat.SimpleInjector/SplatSimpleInjectorExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat.SimpleInjector/TransientSimpleInjectorRegistration.cs b/src/Splat.SimpleInjector/TransientSimpleInjectorRegistration.cs
index e84a3f486..e5d4873bc 100644
--- a/src/Splat.SimpleInjector/TransientSimpleInjectorRegistration.cs
+++ b/src/Splat.SimpleInjector/TransientSimpleInjectorRegistration.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,12 +8,7 @@
namespace Splat.SimpleInjector;
-internal class TransientSimpleInjectorRegistration : Registration
+internal class TransientSimpleInjectorRegistration(Container container, Type implementationType, Func? instanceCreator = null) : Registration(Lifestyle.Transient, container, implementationType, instanceCreator!)
{
- public TransientSimpleInjectorRegistration(Container container, Type implementationType, Func? instanceCreator = null)
- : base(Lifestyle.Transient, container, implementationType, instanceCreator!)
- {
- }
-
public override Expression BuildExpression() => BuildTransientExpression();
}
diff --git a/src/Splat.Tests/Logging/FullLoggers/NLogLoggerTests.cs b/src/Splat.Tests/Logging/FullLoggers/NLogLoggerTests.cs
index 511b1d310..4bc8beb7b 100644
--- a/src/Splat.Tests/Logging/FullLoggers/NLogLoggerTests.cs
+++ b/src/Splat.Tests/Logging/FullLoggers/NLogLoggerTests.cs
@@ -55,7 +55,7 @@ protected override (IFullLogger logger, IMockLogTarget mockTarget) GetLogger(Log
private class MemoryTargetWrapper : TargetWithLayout, IMockLogTarget
{
- private readonly List<(LogLevel, string)> _logs = new();
+ private readonly List<(LogLevel, string)> _logs = [];
public MemoryTargetWrapper() => Name = "test wrapper";
diff --git a/src/Splat.Tests/Logging/FullLoggers/SerilogLoggerTests.cs b/src/Splat.Tests/Logging/FullLoggers/SerilogLoggerTests.cs
index e15bb905c..202523d2a 100644
--- a/src/Splat.Tests/Logging/FullLoggers/SerilogLoggerTests.cs
+++ b/src/Splat.Tests/Logging/FullLoggers/SerilogLoggerTests.cs
@@ -128,7 +128,7 @@ private static (Logger logger, IMockLogTarget mockTarget) CreateSerilogger(LogLe
private class LogTarget : ILogEventSink, IMockLogTarget
{
private static readonly MessageTemplateTextFormatter _formatter = new("{Message} {Exception}", CultureInfo.InvariantCulture);
- private readonly List<(LogLevel logLevel, string message)> _logs = new();
+ private readonly List<(LogLevel logLevel, string message)> _logs = [];
public ICollection<(LogLevel logLevel, string message)> Logs => _logs;
diff --git a/src/Splat.Tests/Logging/WrappingFullLoggers/ConsoleLoggerTests.cs b/src/Splat.Tests/Logging/WrappingFullLoggers/ConsoleLoggerTests.cs
index ebb5f54fd..38a832481 100644
--- a/src/Splat.Tests/Logging/WrappingFullLoggers/ConsoleLoggerTests.cs
+++ b/src/Splat.Tests/Logging/WrappingFullLoggers/ConsoleLoggerTests.cs
@@ -24,7 +24,7 @@ protected override (IFullLogger logger, IMockLogTarget mockTarget) GetLogger(Log
private class ConsoleWriter : TextWriter, IMockLogTarget
{
- private readonly List<(LogLevel logLevel, string message)> _logs = new();
+ private readonly List<(LogLevel logLevel, string message)> _logs = [];
public override Encoding Encoding => Encoding.UTF8;
diff --git a/src/Splat.Tests/Logging/WrappingFullLoggers/Log4NetLoggerTests.cs b/src/Splat.Tests/Logging/WrappingFullLoggers/Log4NetLoggerTests.cs
index 35ca5a345..ea2da1621 100644
--- a/src/Splat.Tests/Logging/WrappingFullLoggers/Log4NetLoggerTests.cs
+++ b/src/Splat.Tests/Logging/WrappingFullLoggers/Log4NetLoggerTests.cs
@@ -77,11 +77,9 @@ private MemoryTargetWrapper CreateRepository(LogLevel minimumLogLevel)
return memoryWrapper;
}
- private class MemoryTargetWrapper : IMockLogTarget
+ private class MemoryTargetWrapper(global::log4net.Appender.MemoryAppender memoryTarget) : IMockLogTarget
{
- public MemoryTargetWrapper(global::log4net.Appender.MemoryAppender memoryTarget) => MemoryTarget = memoryTarget;
-
- public global::log4net.Appender.MemoryAppender MemoryTarget { get; }
+ public global::log4net.Appender.MemoryAppender MemoryTarget { get; } = memoryTarget;
public ICollection<(LogLevel logLevel, string message)> Logs
{
diff --git a/src/Splat.Tests/Logging/WrappingFullLoggers/MicrosoftExtensionsLoggingLoggerTests.cs b/src/Splat.Tests/Logging/WrappingFullLoggers/MicrosoftExtensionsLoggingLoggerTests.cs
index 7b9a6c3cb..c366ca727 100644
--- a/src/Splat.Tests/Logging/WrappingFullLoggers/MicrosoftExtensionsLoggingLoggerTests.cs
+++ b/src/Splat.Tests/Logging/WrappingFullLoggers/MicrosoftExtensionsLoggingLoggerTests.cs
@@ -43,12 +43,10 @@ protected override (IFullLogger logger, IMockLogTarget mockTarget) GetLogger(Log
///
/// Mock Logger for Testing Microsoft.Extensions.Logging.
///
- private sealed class MockActualMicrosoftExtensionsLoggingLogger : global::Microsoft.Extensions.Logging.ILogger, IMockLogTarget
+ private sealed class MockActualMicrosoftExtensionsLoggingLogger(global::Microsoft.Extensions.Logging.LogLevel logLevel) : global::Microsoft.Extensions.Logging.ILogger, IMockLogTarget
{
- private readonly List<(LogLevel, string)> _logs = new();
- private readonly global::Microsoft.Extensions.Logging.LogLevel _logLevel;
-
- public MockActualMicrosoftExtensionsLoggingLogger(global::Microsoft.Extensions.Logging.LogLevel logLevel) => _logLevel = logLevel;
+ private readonly List<(LogLevel, string)> _logs = [];
+ private readonly global::Microsoft.Extensions.Logging.LogLevel _logLevel = logLevel;
public ICollection<(LogLevel logLevel, string message)> Logs => _logs;
diff --git a/src/Splat.Tests/Mocks/TextLogger.cs b/src/Splat.Tests/Mocks/TextLogger.cs
index 0323565bf..642f3e1ee 100644
--- a/src/Splat.Tests/Mocks/TextLogger.cs
+++ b/src/Splat.Tests/Mocks/TextLogger.cs
@@ -11,8 +11,8 @@ namespace Splat.Tests.Mocks;
///
public class TextLogger : ILogger, IMockLogTarget
{
- private readonly List _types = new();
- private readonly List<(LogLevel, string)> _logs = new();
+ private readonly List _types = [];
+ private readonly List<(LogLevel, string)> _logs = [];
///
public ICollection<(LogLevel logLevel, string message)> Logs => _logs;
diff --git a/src/Splat.Tests/Splat.Tests.csproj b/src/Splat.Tests/Splat.Tests.csproj
index 6073e093b..c61aac49c 100644
--- a/src/Splat.Tests/Splat.Tests.csproj
+++ b/src/Splat.Tests/Splat.Tests.csproj
@@ -3,8 +3,6 @@
net6.0-windows$(NoWarn);1591;CA1707;SA1633;CA2000;CA1034
- latest
- latestenable
diff --git a/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingManager.cs b/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingManager.cs
index b70ad2e23..fec208b62 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingManager.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingSession.cs b/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingSession.cs
index f4eb84a94..8b780262d 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingSession.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/DefaultFeatureUsageTrackingSession.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ApplicationPerformanceMonitoring/EnableFeatureUsageTrackingExtensions.cs b/src/Splat/ApplicationPerformanceMonitoring/EnableFeatureUsageTrackingExtensions.cs
index f68ab03d1..611a553de 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/EnableFeatureUsageTrackingExtensions.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/EnableFeatureUsageTrackingExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -22,12 +22,11 @@ public static IFeatureUsageTrackingSession FeatureUsageTrackingSession(
string featureName)
{
var featureUsageTrackingSession = Locator.Current.GetService();
- if (featureUsageTrackingSession is null)
+ return featureUsageTrackingSession switch
{
- throw new InvalidOperationException("Feature Usage Tracking Manager is null. This should never happen, your dependency resolver is broken");
- }
-
- return featureUsageTrackingSession.GetFeatureUsageTrackingSession(featureName);
+ null => throw new InvalidOperationException("Feature Usage Tracking Manager is null. This should never happen, your dependency resolver is broken"),
+ _ => featureUsageTrackingSession.GetFeatureUsageTrackingSession(featureName)
+ };
}
///
diff --git a/src/Splat/ApplicationPerformanceMonitoring/FuncFeatureUsageTrackingManager.cs b/src/Splat/ApplicationPerformanceMonitoring/FuncFeatureUsageTrackingManager.cs
index 3be60df93..ab0319d4e 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/FuncFeatureUsageTrackingManager.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/FuncFeatureUsageTrackingManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,18 +8,15 @@ namespace Splat.ApplicationPerformanceMonitoring;
///
/// Func based Feature Usage Tracking Manager.
///
-public class FuncFeatureUsageTrackingManager : IFeatureUsageTrackingManager
+///
+/// Initializes a new instance of the class.
+///
+///
+/// Factory function for a Feature Usage Tracking Session.
+///
+public class FuncFeatureUsageTrackingManager(Func featureUsageTrackingSessionFunc) : IFeatureUsageTrackingManager
{
- private readonly Func _featureUsageTrackingSessionFunc;
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// Factory function for a Feature Usage Tracking Session.
- ///
- public FuncFeatureUsageTrackingManager(Func featureUsageTrackingSessionFunc) =>
- _featureUsageTrackingSessionFunc = featureUsageTrackingSessionFunc ??
+ private readonly Func _featureUsageTrackingSessionFunc = featureUsageTrackingSessionFunc ??
throw new ArgumentNullException(nameof(featureUsageTrackingSessionFunc));
///
diff --git a/src/Splat/ApplicationPerformanceMonitoring/IEnableFeatureUsageTracking.cs b/src/Splat/ApplicationPerformanceMonitoring/IEnableFeatureUsageTracking.cs
index 27a72bf52..f18275312 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/IEnableFeatureUsageTracking.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/IEnableFeatureUsageTracking.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -11,6 +11,7 @@ namespace Splat.ApplicationPerformanceMonitoring;
/// Interface for exposing Feature Usage Tracking as an extension to a class.
///
[ComVisible(false)]
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Intended through design")]
public interface IEnableFeatureUsageTracking
{
}
diff --git a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingManager.cs b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingManager.cs
index b4c36898f..ee5797d0e 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingManager.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession.cs b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession.cs
index 87bfcf1a3..dfcd39a5a 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession{TReferenceType}.cs b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession{TReferenceType}.cs
index 1f09c32c7..c1707509c 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession{TReferenceType}.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/IFeatureUsageTrackingSession{TReferenceType}.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ApplicationPerformanceMonitoring/IViewTracking.cs b/src/Splat/ApplicationPerformanceMonitoring/IViewTracking.cs
index 7e75f351d..c863f5404 100644
--- a/src/Splat/ApplicationPerformanceMonitoring/IViewTracking.cs
+++ b/src/Splat/ApplicationPerformanceMonitoring/IViewTracking.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/AssemblyFinder.cs b/src/Splat/AssemblyFinder.cs
index 2ec4ac98e..3748e010b 100644
--- a/src/Splat/AssemblyFinder.cs
+++ b/src/Splat/AssemblyFinder.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -28,8 +28,13 @@ internal static class AssemblyFinder
var toSearch = new[]
{
+#if NET6_0_OR_GREATER
+ thisTypeName.Replace(thisType.FullName + ", ", string.Empty, StringComparison.CurrentCulture),
+ thisTypeName.Replace(thisType.FullName + ", ", string.Empty, StringComparison.CurrentCulture).Replace(".Portable", string.Empty, StringComparison.CurrentCulture),
+#else
thisTypeName.Replace(thisType.FullName + ", ", string.Empty),
thisTypeName.Replace(thisType.FullName + ", ", string.Empty).Replace(".Portable", string.Empty),
+#endif
}.Select(x => new AssemblyName(x)).ToArray();
foreach (var assembly in toSearch)
diff --git a/src/Splat/Disposables/ActionDisposable.cs b/src/Splat/Disposables/ActionDisposable.cs
index 76f0361aa..48ceceb03 100644
--- a/src/Splat/Disposables/ActionDisposable.cs
+++ b/src/Splat/Disposables/ActionDisposable.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,11 +8,9 @@ namespace Splat;
///
/// A disposable which will call the specified action.
///
-internal sealed class ActionDisposable : IDisposable
+internal sealed class ActionDisposable(Action block) : IDisposable
{
- private Action _block;
-
- public ActionDisposable(Action block) => _block = block;
+ private Action _block = block;
///
/// Gets a action disposable which does nothing.
diff --git a/src/Splat/Disposables/BooleanDisposable.cs b/src/Splat/Disposables/BooleanDisposable.cs
index dcb58dc96..c84240141 100644
--- a/src/Splat/Disposables/BooleanDisposable.cs
+++ b/src/Splat/Disposables/BooleanDisposable.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Disposables/CompositeDisposable.cs b/src/Splat/Disposables/CompositeDisposable.cs
index 11ff350dd..c1858d920 100644
--- a/src/Splat/Disposables/CompositeDisposable.cs
+++ b/src/Splat/Disposables/CompositeDisposable.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -22,7 +22,7 @@ internal sealed class CompositeDisposable : IDisposable
///
/// Initializes a new instance of the class with no disposables contained by it initially.
///
- public CompositeDisposable() => _disposables = new();
+ public CompositeDisposable() => _disposables = [];
///
/// Initializes a new instance of the class with the specified number of disposables.
diff --git a/src/Splat/Logging/ActionLogger.cs b/src/Splat/Logging/ActionLogger.cs
index ed93ad9c8..2c01af047 100644
--- a/src/Splat/Logging/ActionLogger.cs
+++ b/src/Splat/Logging/ActionLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -10,31 +10,23 @@ namespace Splat;
///
/// A logger where you pass in Action delegates that will be invoked when the Write methods are invoked.
///
-public class ActionLogger : ILogger
+///
+/// Initializes a new instance of the class.
+///
+/// A action which is called when the is called.
+/// A action which is called when the is called.
+/// A action which is called when the is called.
+/// A action which is called when the is called.
+public class ActionLogger(
+ Action writeNoType,
+ Action writeWithType,
+ Action writeNoTypeWithException,
+ Action writeWithTypeAndException) : ILogger
{
- private readonly Action _writeNoType;
- private readonly Action _writeNoTypeWithException;
- private readonly Action _writeWithType;
- private readonly Action _writeWithTypeAndException;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// A action which is called when the is called.
- /// A action which is called when the is called.
- /// A action which is called when the is called.
- /// A action which is called when the is called.
- public ActionLogger(
- Action writeNoType,
- Action writeWithType,
- Action writeNoTypeWithException,
- Action writeWithTypeAndException)
- {
- _writeNoType = writeNoType;
- _writeWithType = writeWithType;
- _writeNoTypeWithException = writeNoTypeWithException;
- _writeWithTypeAndException = writeWithTypeAndException;
- }
+ private readonly Action _writeNoType = writeNoType;
+ private readonly Action _writeNoTypeWithException = writeNoTypeWithException;
+ private readonly Action _writeWithType = writeWithType;
+ private readonly Action _writeWithTypeAndException = writeWithTypeAndException;
///
public LogLevel Level { get; set; }
diff --git a/src/Splat/Logging/AllocationFreeLoggerBase.cs b/src/Splat/Logging/AllocationFreeLoggerBase.cs
index c4cdebc7e..5606c84a7 100644
--- a/src/Splat/Logging/AllocationFreeLoggerBase.cs
+++ b/src/Splat/Logging/AllocationFreeLoggerBase.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/ConsoleLogger.cs b/src/Splat/Logging/ConsoleLogger.cs
index b7fba6a83..539cda869 100644
--- a/src/Splat/Logging/ConsoleLogger.cs
+++ b/src/Splat/Logging/ConsoleLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/DebugLogger.cs b/src/Splat/Logging/DebugLogger.cs
index 84f9f4534..31b6eb4b8 100644
--- a/src/Splat/Logging/DebugLogger.cs
+++ b/src/Splat/Logging/DebugLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/DefaultLogManager.cs b/src/Splat/Logging/DefaultLogManager.cs
index 8cfd58bb2..f77b34973 100644
--- a/src/Splat/Logging/DefaultLogManager.cs
+++ b/src/Splat/Logging/DefaultLogManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/FullLoggerExtensions.cs b/src/Splat/Logging/FullLoggerExtensions.cs
index 4b95d3a52..cec7fe79f 100644
--- a/src/Splat/Logging/FullLoggerExtensions.cs
+++ b/src/Splat/Logging/FullLoggerExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/FuncLogManager.cs b/src/Splat/Logging/FuncLogManager.cs
index ea87b85bb..50b0fc60c 100644
--- a/src/Splat/Logging/FuncLogManager.cs
+++ b/src/Splat/Logging/FuncLogManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,15 +8,13 @@ namespace Splat;
///
/// A log manager which will generate the by using the specified Func.
///
-public class FuncLogManager : ILogManager
+///
+/// Initializes a new instance of the class.
+///
+/// The function which will be used to generate the .
+public class FuncLogManager(Func getLoggerFunc) : ILogManager
{
- private readonly Func _inner;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The function which will be used to generate the .
- public FuncLogManager(Func getLoggerFunc) => _inner = getLoggerFunc;
+ private readonly Func _inner = getLoggerFunc;
///
public IFullLogger GetLogger(Type type) => _inner(type);
diff --git a/src/Splat/Logging/IAllocationFreeErrorLogger.cs b/src/Splat/Logging/IAllocationFreeErrorLogger.cs
index 89dd731ec..b238ae3ec 100644
--- a/src/Splat/Logging/IAllocationFreeErrorLogger.cs
+++ b/src/Splat/Logging/IAllocationFreeErrorLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/IAllocationFreeLogger.cs b/src/Splat/Logging/IAllocationFreeLogger.cs
index 2833f1c2f..7dcc39bbe 100644
--- a/src/Splat/Logging/IAllocationFreeLogger.cs
+++ b/src/Splat/Logging/IAllocationFreeLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/IEnableLogger.cs b/src/Splat/Logging/IEnableLogger.cs
index 5bae6bd54..fd482a50d 100644
--- a/src/Splat/Logging/IEnableLogger.cs
+++ b/src/Splat/Logging/IEnableLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -13,6 +13,7 @@ namespace Splat;
/// log.
///
[ComVisible(false)]
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "By Design")]
public interface IEnableLogger
{
}
diff --git a/src/Splat/Logging/IFullLogger.cs b/src/Splat/Logging/IFullLogger.cs
index a2af5eede..3441abf8d 100644
--- a/src/Splat/Logging/IFullLogger.cs
+++ b/src/Splat/Logging/IFullLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/ILogManager.cs b/src/Splat/Logging/ILogManager.cs
index 9dfc716d6..fd4639096 100644
--- a/src/Splat/Logging/ILogManager.cs
+++ b/src/Splat/Logging/ILogManager.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/ILogger.cs b/src/Splat/Logging/ILogger.cs
index a2d6e5862..ead27fa95 100644
--- a/src/Splat/Logging/ILogger.cs
+++ b/src/Splat/Logging/ILogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/IStaticFullLogger.cs b/src/Splat/Logging/IStaticFullLogger.cs
index 377d29a12..3ed2bc14b 100644
--- a/src/Splat/Logging/IStaticFullLogger.cs
+++ b/src/Splat/Logging/IStaticFullLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/LocalizableAttribute.cs b/src/Splat/Logging/LocalizableAttribute.cs
index c5133e6fe..62f639aa6 100644
--- a/src/Splat/Logging/LocalizableAttribute.cs
+++ b/src/Splat/Logging/LocalizableAttribute.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/LogHost.cs b/src/Splat/Logging/LogHost.cs
index 2e9dee578..10b2c29de 100644
--- a/src/Splat/Logging/LogHost.cs
+++ b/src/Splat/Logging/LogHost.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/LogLevel.cs b/src/Splat/Logging/LogLevel.cs
index 6c78473de..f1bd1c64f 100644
--- a/src/Splat/Logging/LogLevel.cs
+++ b/src/Splat/Logging/LogLevel.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,7 +8,9 @@ namespace Splat;
///
/// Represents the minimum log level a will start emitting from.
///
+#pragma warning disable CA1008 // Enums should have zero value
public enum LogLevel
+#pragma warning restore CA1008 // Enums should have zero value
{
///
/// The log message is for debuging purposes.
diff --git a/src/Splat/Logging/LogManagerMixin.cs b/src/Splat/Logging/LogManagerMixin.cs
index 6602afd53..c45d4c927 100644
--- a/src/Splat/Logging/LogManagerMixin.cs
+++ b/src/Splat/Logging/LogManagerMixin.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/LoggingException.cs b/src/Splat/Logging/LoggingException.cs
index 40dccc898..976112f16 100644
--- a/src/Splat/Logging/LoggingException.cs
+++ b/src/Splat/Logging/LoggingException.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/NullLogger.cs b/src/Splat/Logging/NullLogger.cs
index 3ceaa69d2..a5bddd219 100644
--- a/src/Splat/Logging/NullLogger.cs
+++ b/src/Splat/Logging/NullLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Logging/StaticFullLogger.cs b/src/Splat/Logging/StaticFullLogger.cs
index c68a9a56c..de41c85a1 100644
--- a/src/Splat/Logging/StaticFullLogger.cs
+++ b/src/Splat/Logging/StaticFullLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -11,15 +11,13 @@ namespace Splat;
///
/// A full logger which used by the default static logger to allow capture of .NET framework caller data. Wraps a .
///
-public sealed class StaticFullLogger : IStaticFullLogger
+///
+/// Initializes a new instance of the class.
+///
+/// The to wrap in this class.
+public sealed class StaticFullLogger(IFullLogger fullLogger) : IStaticFullLogger
{
- private readonly IFullLogger _fullLogger;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The to wrap in this class.
- public StaticFullLogger(IFullLogger fullLogger) => _fullLogger = fullLogger ?? throw new ArgumentNullException(nameof(fullLogger));
+ private readonly IFullLogger _fullLogger = fullLogger ?? throw new ArgumentNullException(nameof(fullLogger));
///
public LogLevel Level => _fullLogger.Level;
diff --git a/src/Splat/Logging/WrappingFullLogger.cs b/src/Splat/Logging/WrappingFullLogger.cs
index 65720baeb..b69b15f74 100644
--- a/src/Splat/Logging/WrappingFullLogger.cs
+++ b/src/Splat/Logging/WrappingFullLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -11,22 +11,14 @@ namespace Splat;
///
/// A full logger which wraps a .
///
-public class WrappingFullLogger : AllocationFreeLoggerBase, IFullLogger
+///
+/// Initializes a new instance of the class.
+///
+/// The to wrap in this class.
+public class WrappingFullLogger(ILogger inner) : AllocationFreeLoggerBase(inner), IFullLogger
{
- private readonly ILogger _inner;
- private readonly MethodInfo _stringFormat;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The to wrap in this class.
- public WrappingFullLogger(ILogger inner)
- : base(inner)
- {
- _inner = inner ?? throw new ArgumentNullException(nameof(inner));
-
- _stringFormat = typeof(string).GetMethod("Format", new[] { typeof(IFormatProvider), typeof(string), typeof(object[]) }) ?? throw new InvalidOperationException("Cannot find the Format method which is required.");
- }
+ private readonly ILogger _inner = inner ?? throw new ArgumentNullException(nameof(inner));
+ private readonly MethodInfo _stringFormat = typeof(string).GetMethod("Format", new[] { typeof(IFormatProvider), typeof(string), typeof(object[]) }) ?? throw new InvalidOperationException("Cannot find the Format method which is required.");
///
public void Debug(T value)
diff --git a/src/Splat/Logging/WrappingLogLevelLogger.cs b/src/Splat/Logging/WrappingLogLevelLogger.cs
index 432c4de03..7f9081813 100644
--- a/src/Splat/Logging/WrappingLogLevelLogger.cs
+++ b/src/Splat/Logging/WrappingLogLevelLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -10,16 +10,14 @@ namespace Splat;
///
/// A prefix logger which wraps a .
///
-public class WrappingLogLevelLogger : ILogger
+///
+/// Initializes a new instance of the class.
+/// Placeholder.
+///
+/// The to wrap in this class.
+public class WrappingLogLevelLogger(ILogger inner) : ILogger
{
- private readonly ILogger _inner;
-
- ///
- /// Initializes a new instance of the class.
- /// Placeholder.
- ///
- /// The to wrap in this class.
- public WrappingLogLevelLogger(ILogger inner) => _inner = inner;
+ private readonly ILogger _inner = inner;
///
public LogLevel Level => _inner.Level;
diff --git a/src/Splat/Logging/WrappingPrefixLogger.cs b/src/Splat/Logging/WrappingPrefixLogger.cs
index fd71c3e03..e112be3b9 100644
--- a/src/Splat/Logging/WrappingPrefixLogger.cs
+++ b/src/Splat/Logging/WrappingPrefixLogger.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -10,22 +10,16 @@ namespace Splat;
///
/// A prefix logger which wraps a .
///
-public class WrappingPrefixLogger : ILogger
+///
+/// Initializes a new instance of the class.
+/// Placeholder.
+///
+/// The to wrap in this class.
+/// The type which will be calling this logger.
+public class WrappingPrefixLogger(ILogger inner, Type callingType) : ILogger
{
- private readonly ILogger _inner;
- private readonly string _prefix;
-
- ///
- /// Initializes a new instance of the class.
- /// Placeholder.
- ///
- /// The to wrap in this class.
- /// The type which will be calling this logger.
- public WrappingPrefixLogger(ILogger inner, Type callingType)
- {
- _inner = inner;
- _prefix = $"{callingType?.Name}: ";
- }
+ private readonly ILogger _inner = inner;
+ private readonly string _prefix = $"{callingType?.Name}: ";
///
public LogLevel Level => _inner.Level;
diff --git a/src/Splat/Maths/PointMathExtensions.cs b/src/Splat/Maths/PointMathExtensions.cs
index ee321b4d4..f0e98fb51 100644
--- a/src/Splat/Maths/PointMathExtensions.cs
+++ b/src/Splat/Maths/PointMathExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Maths/RectEdge.cs b/src/Splat/Maths/RectEdge.cs
index 24d3c0c6b..d7f0e6dcf 100644
--- a/src/Splat/Maths/RectEdge.cs
+++ b/src/Splat/Maths/RectEdge.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Maths/RectangleMathExtensions.cs b/src/Splat/Maths/RectangleMathExtensions.cs
index afcb99484..d29a0cbf1 100644
--- a/src/Splat/Maths/RectangleMathExtensions.cs
+++ b/src/Splat/Maths/RectangleMathExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Maths/SizeMathExtensions.cs b/src/Splat/Maths/SizeMathExtensions.cs
index 543f372bf..c80a0f0a5 100644
--- a/src/Splat/Maths/SizeMathExtensions.cs
+++ b/src/Splat/Maths/SizeMathExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/MemoizingMRUCache.cs b/src/Splat/MemoizingMRUCache.cs
index 285d42d2c..de2c17983 100644
--- a/src/Splat/MemoizingMRUCache.cs
+++ b/src/Splat/MemoizingMRUCache.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -99,7 +99,7 @@ public MemoizingMRUCache(Func calculationFunc, int maxSiz
_maxCacheSize = maxSize;
_comparer = paramComparer ?? EqualityComparer.Default;
_cacheMRUList = new();
- _cacheEntries = new();
+ _cacheEntries = [];
}
///
@@ -245,6 +245,7 @@ public void InvalidateAll(bool aggregateReleaseExceptions = false)
var exceptions = new List(oldCacheToClear.Count);
foreach (var item in oldCacheToClear)
{
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
_releaseFunction?.Invoke(item.Value.value);
@@ -253,6 +254,7 @@ public void InvalidateAll(bool aggregateReleaseExceptions = false)
{
exceptions.Add(e);
}
+#pragma warning restore CA1031 // Do not catch general exception types
}
if (exceptions.Count > 0)
diff --git a/src/Splat/ModeDetection/DefaultModeDetector.cs b/src/Splat/ModeDetection/DefaultModeDetector.cs
index dfbad2834..faa0cdbd8 100644
--- a/src/Splat/ModeDetection/DefaultModeDetector.cs
+++ b/src/Splat/ModeDetection/DefaultModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -26,6 +26,7 @@ public class DefaultModeDetector : IModeDetector, IEnableLogger
"NCRUNCH",
};
+#pragma warning disable CA1031 // Do not catch general exception types
try
{
return SearchForAssembly(testAssemblies);
@@ -35,6 +36,7 @@ public class DefaultModeDetector : IModeDetector, IEnableLogger
this.Log().Debug(e, "Unable to find unit test runner value");
return null;
}
+#pragma warning restore CA1031 // Do not catch general exception types
}
private static bool SearchForAssembly(IEnumerable assemblyList) =>
diff --git a/src/Splat/ModeDetection/IModeDetector.cs b/src/Splat/ModeDetection/IModeDetector.cs
index 54a9da33b..50fde276d 100644
--- a/src/Splat/ModeDetection/IModeDetector.cs
+++ b/src/Splat/ModeDetection/IModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ModeDetection/Mode.cs b/src/Splat/ModeDetection/Mode.cs
index d6ffe5aa2..ad8d0321a 100644
--- a/src/Splat/ModeDetection/Mode.cs
+++ b/src/Splat/ModeDetection/Mode.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ModeDetection/ModeDetector.cs b/src/Splat/ModeDetection/ModeDetector.cs
index 4e12c3e28..5e21004c6 100644
--- a/src/Splat/ModeDetection/ModeDetector.cs
+++ b/src/Splat/ModeDetection/ModeDetector.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Properties/AssemblyInfo.cs b/src/Splat/Properties/AssemblyInfo.cs
index 12f309784..310221a25 100644
--- a/src/Splat/Properties/AssemblyInfo.cs
+++ b/src/Splat/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/DependencyResolverMixins.cs b/src/Splat/ServiceLocation/DependencyResolverMixins.cs
index cc7b07ef2..c0bfbdf60 100644
--- a/src/Splat/ServiceLocation/DependencyResolverMixins.cs
+++ b/src/Splat/ServiceLocation/DependencyResolverMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/FuncDependencyResolver.cs b/src/Splat/ServiceLocation/FuncDependencyResolver.cs
index 856103a93..958396c60 100644
--- a/src/Splat/ServiceLocation/FuncDependencyResolver.cs
+++ b/src/Splat/ServiceLocation/FuncDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -10,39 +10,31 @@ namespace Splat;
/// GetService is always implemented via GetServices().LastOrDefault().
/// This container is not thread safe.
///
-public class FuncDependencyResolver : IDependencyResolver
+///
+/// Initializes a new instance of the class.
+///
+/// A func which will return all the services contained for the specified service type and contract.
+/// A func which will be called when a service type and contract are registered.
+/// A func which will unregister the current registered element for a service type and contract.
+/// A func which will unregister all the registered elements for a service type and contract.
+/// A optional disposable which is called when this resolver is disposed.
+public class FuncDependencyResolver(
+ Func> getAllServices,
+ Action, Type?, string?>? register = null,
+ Action? unregisterCurrent = null,
+ Action? unregisterAll = null,
+ IDisposable? toDispose = null) : IDependencyResolver
{
- private readonly Func> _innerGetServices;
- private readonly Action, Type?, string?>? _innerRegister;
- private readonly Action? _unregisterCurrent;
- private readonly Action? _unregisterAll;
- private readonly Dictionary<(Type? type, string callback), List>> _callbackRegistry = new();
-
- private IDisposable _inner;
+ private readonly Func> _innerGetServices = getAllServices;
+ private readonly Action, Type?, string?>? _innerRegister = register;
+ private readonly Action? _unregisterCurrent = unregisterCurrent;
+ private readonly Action? _unregisterAll = unregisterAll;
+ private readonly Dictionary<(Type? type, string callback), List>> _callbackRegistry = [];
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Field is Disposed using Interlocked method")]
+ private IDisposable _inner = toDispose ?? ActionDisposable.Empty;
private bool _isDisposed;
- ///
- /// Initializes a new instance of the class.
- ///
- /// A func which will return all the services contained for the specified service type and contract.
- /// A func which will be called when a service type and contract are registered.
- /// A func which will unregister the current registered element for a service type and contract.
- /// A func which will unregister all the registered elements for a service type and contract.
- /// A optional disposable which is called when this resolver is disposed.
- public FuncDependencyResolver(
- Func> getAllServices,
- Action, Type?, string?>? register = null,
- Action? unregisterCurrent = null,
- Action? unregisterAll = null,
- IDisposable? toDispose = null)
- {
- _innerGetServices = getAllServices;
- _innerRegister = register;
- _unregisterCurrent = unregisterCurrent;
- _unregisterAll = unregisterAll;
- _inner = toDispose ?? ActionDisposable.Empty;
- }
-
///
public object? GetService(Type? serviceType, string? contract = null) =>
GetServices(serviceType, contract).LastOrDefault();
@@ -100,7 +92,7 @@ public void Register(Func factory, Type? serviceType, string? contract
if (disp.IsDisposed)
{
- (toRemove ??= new()).Add(callback);
+ (toRemove ??= []).Add(callback);
}
}
@@ -146,7 +138,7 @@ public IDisposable ServiceRegistrationCallback(Type serviceType, string? contrac
if (!_callbackRegistry.ContainsKey(pair))
{
- _callbackRegistry[pair] = new();
+ _callbackRegistry[pair] = [];
}
_callbackRegistry[pair].Add(callback);
diff --git a/src/Splat/ServiceLocation/IDependencyResolver.cs b/src/Splat/ServiceLocation/IDependencyResolver.cs
index 36a302c29..581fdc0d7 100644
--- a/src/Splat/ServiceLocation/IDependencyResolver.cs
+++ b/src/Splat/ServiceLocation/IDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/IMutableDependencyResolver.cs b/src/Splat/ServiceLocation/IMutableDependencyResolver.cs
index 67eed233a..b9e0f403f 100644
--- a/src/Splat/ServiceLocation/IMutableDependencyResolver.cs
+++ b/src/Splat/ServiceLocation/IMutableDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/IReadonlyDependencyResolver.cs b/src/Splat/ServiceLocation/IReadonlyDependencyResolver.cs
index fe6e26eef..d7b6d0154 100644
--- a/src/Splat/ServiceLocation/IReadonlyDependencyResolver.cs
+++ b/src/Splat/ServiceLocation/IReadonlyDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/InternalLocator.cs b/src/Splat/ServiceLocation/InternalLocator.cs
index 157f1a751..530fe16f0 100644
--- a/src/Splat/ServiceLocation/InternalLocator.cs
+++ b/src/Splat/ServiceLocation/InternalLocator.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,7 +8,7 @@ namespace Splat;
internal class InternalLocator : IDisposable
{
// this has been done to have a default single instance. but allow isolation in unit tests.B
- private readonly List _resolverChanged = new();
+ private readonly List _resolverChanged = [];
private volatile int _resolverChangedNotificationSuspendCount;
internal InternalLocator()
diff --git a/src/Splat/ServiceLocation/Locator.cs b/src/Splat/ServiceLocation/Locator.cs
index 482982892..b60813fed 100644
--- a/src/Splat/ServiceLocation/Locator.cs
+++ b/src/Splat/ServiceLocation/Locator.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -46,7 +46,9 @@ public static class Locator
/// Note you should use or in most situations.
///
/// The locator.
+#pragma warning disable CA1024 // Use properties where appropriate
public static IDependencyResolver GetLocator() => InternalLocator.Internal;
+#pragma warning restore CA1024 // Use properties where appropriate
///
/// This method allows libraries to register themselves to be set up
diff --git a/src/Splat/ServiceLocation/ModernDependencyResolver.cs b/src/Splat/ServiceLocation/ModernDependencyResolver.cs
index 72effb665..aa7ce33a9 100644
--- a/src/Splat/ServiceLocation/ModernDependencyResolver.cs
+++ b/src/Splat/ServiceLocation/ModernDependencyResolver.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -42,9 +42,9 @@ protected ModernDependencyResolver(Dictionary<(Type serviceType, string? contrac
{
_registry = registry is not null ?
registry.ToDictionary(k => k.Key, v => v.Value.ToList()) :
- new();
+ [];
- _callbackRegistry = new();
+ _callbackRegistry = [];
}
///
@@ -77,7 +77,7 @@ public void Register(Func factory, Type? serviceType, string? contract
if (!_registry.ContainsKey(pair))
{
- _registry[pair] = new();
+ _registry[pair] = [];
}
_registry[pair].Add(() =>
@@ -100,7 +100,7 @@ public void Register(Func factory, Type? serviceType, string? contract
if (disp.IsDisposed)
{
- (toRemove ??= new()).Add(callback);
+ (toRemove ??= []).Add(callback);
}
}
@@ -200,7 +200,7 @@ public void UnregisterAll(Type? serviceType, string? contract = null)
var pair = GetKey(serviceType, contract);
- _registry[pair] = new();
+ _registry[pair] = [];
}
///
@@ -225,7 +225,7 @@ public IDisposable ServiceRegistrationCallback(Type serviceType, string? contrac
if (!_callbackRegistry.ContainsKey(pair))
{
- _callbackRegistry[pair] = new();
+ _callbackRegistry[pair] = [];
}
_callbackRegistry[pair].Add(callback);
diff --git a/src/Splat/ServiceLocation/NullServiceType.cs b/src/Splat/ServiceLocation/NullServiceType.cs
index 6ce2f533c..69462cd95 100644
--- a/src/Splat/ServiceLocation/NullServiceType.cs
+++ b/src/Splat/ServiceLocation/NullServiceType.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
@@ -8,16 +8,14 @@ namespace Splat;
///
/// Null Service Type.
///
-public class NullServiceType
+///
+/// Initializes a new instance of the class.
+///
+/// The value factory.
+public class NullServiceType(Func factory)
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The value factory.
- public NullServiceType(Func factory) => Factory = factory;
-
///
/// Gets the Factory.
///
- public Func Factory { get; }
+ public Func Factory { get; } = factory;
}
diff --git a/src/Splat/ServiceLocation/ResolverMixins.cs b/src/Splat/ServiceLocation/ResolverMixins.cs
index 874547826..228472680 100644
--- a/src/Splat/ServiceLocation/ResolverMixins.cs
+++ b/src/Splat/ServiceLocation/ResolverMixins.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/ServiceLocation/ServiceLocationInitialization.cs b/src/Splat/ServiceLocation/ServiceLocationInitialization.cs
index b5713bdb3..618bda076 100644
--- a/src/Splat/ServiceLocation/ServiceLocationInitialization.cs
+++ b/src/Splat/ServiceLocation/ServiceLocationInitialization.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/Splat/Splat.csproj b/src/Splat/Splat.csproj
index 6790a263d..61fc9413b 100644
--- a/src/Splat/Splat.csproj
+++ b/src/Splat/Splat.csproj
@@ -7,7 +7,6 @@
A library to make things cross-platform that should beSplat$(NoWarn);1591
- latestenable
diff --git a/src/Splat/TargetFrameworkExtensions.cs b/src/Splat/TargetFrameworkExtensions.cs
index d7e941f6f..40c0fe957 100644
--- a/src/Splat/TargetFrameworkExtensions.cs
+++ b/src/Splat/TargetFrameworkExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved.
+// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
diff --git a/src/global.json b/src/global.json
index e3feff663..d0516b067 100644
--- a/src/global.json
+++ b/src/global.json
@@ -1,5 +1,9 @@
-
{
+ "sdk": {
+ "version": "7.0.400",
+ "rollForward": "latestMinor",
+ "allowPrerelease": true
+ },
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44"
}
diff --git a/src/stylecop.json b/src/stylecop.json
index 241375bba..a717f3411 100644
--- a/src/stylecop.json
+++ b/src/stylecop.json
@@ -13,7 +13,7 @@
"documentPrivateFields": false,
"documentationCulture": "en-US",
"companyName": ".NET Foundation and Contributors",
- "copyrightText": "Copyright (c) 2021 {companyName}. All rights reserved.\nLicensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the {licenseName} license.\nSee the {licenseFile} file in the project root for full license information.",
+ "copyrightText": "Copyright (c) 2023 {companyName}. All rights reserved.\nLicensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the {licenseName} license.\nSee the {licenseFile} file in the project root for full license information.",
"variables": {
"licenseName": "MIT",
"licenseFile": "LICENSE"