From bef2ef20cd92c50c94262ab40a41e8ea4120c63e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Sat, 30 Jan 2021 15:40:57 -0800 Subject: [PATCH] cleanup: run code formatter and cleanup --- .../MvcApp/Controllers/HomeController.cs | 5 ++++- samples/aspnetcore-mvc/MvcApp/Program.cs | 5 ++++- samples/aspnetcore-mvc/MvcApp/Startup.cs | 5 ++++- .../MvcAppPlugin1/MyPluginController.cs | 5 ++++- samples/aspnetcore/Abstractions/IPlugin.cs | 6 ++++-- .../aspnetcore/Abstractions/IPluginLink.cs | 3 +++ .../MainWebApp/Pages/Index.cshtml.cs | 6 +++--- samples/aspnetcore/MainWebApp/Program.cs | 10 +++------ samples/aspnetcore/MainWebApp/Startup.cs | 11 +++++----- .../aspnetcore/WebAppPlugin1/WebPlugin1.cs | 4 +++- .../aspnetcore/WebAppPlugin2/WebPlugin2.cs | 4 +++- .../DI.HostApp/Program.cs | 7 +++++-- .../DI.SharedAbstractions/Fruit.cs | 5 ++++- .../DI.SharedAbstractions/IFruitConsumer.cs | 5 ++++- .../DI.SharedAbstractions/IFruitProducer.cs | 3 +++ .../DI.SharedAbstractions/IPluginFactory.cs | 5 ++++- .../MyPlugin1/MyFruitProducer.cs | 4 +++- .../MyPlugin1/PluginConfiguration.cs | 5 ++++- .../MyPlugin2/MyFruitConsumer.cs | 5 ++++- .../MyPlugin2/PluginConfiguration.cs | 5 ++++- .../dynamic-implementation/Contracts/Fruit.cs | 7 +++++-- .../Contracts/IFruitService.cs | 5 ++++- .../Contracts/IMixerService.cs | 5 ++++- .../Contracts/IPluginFactory.cs | 5 ++++- .../dynamic-implementation/Host/Program.cs | 11 ++++++---- .../Mixer/MixerPlugin.cs | 5 ++++- .../Mixer/MixerService.cs | 5 ++++- .../Mixer/StandardFruiteService.cs | 5 ++++- .../OverrideFruiteService.cs | 5 ++++- .../ServiceImplementation/OverridePlugin.cs | 5 ++++- samples/hello-world/HostApp/Program.cs | 6 ++++-- samples/hello-world/MyPlugin/MyPlugin1.cs | 4 +++- samples/hello-world/PluginContract/IPlugin.cs | 3 +++ samples/hot-reload/HotReloadApp/Program.cs | 9 +++++--- .../TimestampedPlugin/InfoDisplayer.cs | 5 ++++- src/Plugins/Internal/Debouncer.cs | 7 +++++-- .../Loader/AssemblyLoadContextBuilder.cs | 14 ++++++------- .../Loader/DependencyContextExtensions.cs | 19 +++++++---------- src/Plugins/Loader/ManagedLoadContext.cs | 4 ++-- src/Plugins/Loader/RuntimeConfigExtensions.cs | 2 +- src/Plugins/PluginLoader.cs | 10 +++++---- src/Plugins/Properties/AssemblyInfo.cs | 3 +++ .../Plugins.Tests/BasicAssemblyLoaderTests.cs | 3 +++ test/Plugins.Tests/DebouncerTests.cs | 7 +++++-- test/Plugins.Tests/ManageLoadContextTests.cs | 11 ++++++---- test/Plugins.Tests/PrivateDependencyTests.cs | 6 ++++-- test/Plugins.Tests/SharedTypesTests.cs | 12 ++++++----- .../TestProjectReferenceAttribute.cs | 5 ++++- test/Plugins.Tests/Utilities/TestResources.cs | 5 ++++- test/TestProjects/Banana/Banana.cs | 4 +++- test/TestProjects/DrawingApp/Finder.cs | 5 ++++- test/TestProjects/JsonNet10/Class1.cs | 3 ++- test/TestProjects/JsonNet11/Class1.cs | 3 ++- test/TestProjects/JsonNet9/Class1.cs | 3 ++- .../NativeDependencyLoader.cs | 7 +++++-- .../NetStandardClassLib/Class1.cs | 5 ++++- .../Pl\303\241tano/Pl\303\241tano.cs" | 4 +++- test/TestProjects/PowerShellPlugin/Program.cs | 21 ++++++++++--------- test/TestProjects/ReferencedLibv1/Class1.cs | 3 ++- test/TestProjects/ReferencedLibv1/IFruit.cs | 3 ++- test/TestProjects/ReferencedLibv2/Class1.cs | 3 ++- .../SharedAbstraction.v1/SharedType.cs | 3 +++ test/TestProjects/SqlClientApp/Program.cs | 12 +++++------ test/TestProjects/Strawberry/Strawberry.cs | 4 +++- .../TransitiveDep.v1/TransitiveSharedType.cs | 3 +++ .../TransitivePlugin/PluginConfig.cs | 5 ++++- .../WithOurPluginsPluginA/Class1.cs | 4 +++- .../WithOurPluginsPluginB/Class1.cs | 4 +++- .../WithOurPluginsPluginContract/ISayHello.cs | 3 ++- .../WithOwnPlugins/WithOwnPlugins.cs | 2 +- .../WithOwnPluginsContract/IWithOwnPlugins.cs | 5 ++++- test/TestProjects/XunitSample/Class1.cs | 3 ++- 72 files changed, 281 insertions(+), 132 deletions(-) diff --git a/samples/aspnetcore-mvc/MvcApp/Controllers/HomeController.cs b/samples/aspnetcore-mvc/MvcApp/Controllers/HomeController.cs index 3bc136f..8c32c5d 100644 --- a/samples/aspnetcore-mvc/MvcApp/Controllers/HomeController.cs +++ b/samples/aspnetcore-mvc/MvcApp/Controllers/HomeController.cs @@ -1,4 +1,7 @@ -using Microsoft.AspNetCore.Mvc; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Mvc; namespace MvcWebApp.Controllers { diff --git a/samples/aspnetcore-mvc/MvcApp/Program.cs b/samples/aspnetcore-mvc/MvcApp/Program.cs index 8018f0f..7d71032 100644 --- a/samples/aspnetcore-mvc/MvcApp/Program.cs +++ b/samples/aspnetcore-mvc/MvcApp/Program.cs @@ -1,4 +1,7 @@ -using Microsoft.AspNetCore; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace MvcWebApp diff --git a/samples/aspnetcore-mvc/MvcApp/Startup.cs b/samples/aspnetcore-mvc/MvcApp/Startup.cs index 6b8bc3b..05326a4 100644 --- a/samples/aspnetcore-mvc/MvcApp/Startup.cs +++ b/samples/aspnetcore-mvc/MvcApp/Startup.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc; diff --git a/samples/aspnetcore-mvc/MvcAppPlugin1/MyPluginController.cs b/samples/aspnetcore-mvc/MvcAppPlugin1/MyPluginController.cs index 0a092b9..9bd61a2 100644 --- a/samples/aspnetcore-mvc/MvcAppPlugin1/MyPluginController.cs +++ b/samples/aspnetcore-mvc/MvcAppPlugin1/MyPluginController.cs @@ -1,4 +1,7 @@ -using Microsoft.AspNetCore.Mvc; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Mvc; namespace MvcAppPlugin1 { diff --git a/samples/aspnetcore/Abstractions/IPlugin.cs b/samples/aspnetcore/Abstractions/IPlugin.cs index fc8d7d7..a9e7744 100644 --- a/samples/aspnetcore/Abstractions/IPlugin.cs +++ b/samples/aspnetcore/Abstractions/IPlugin.cs @@ -1,6 +1,8 @@ -using System; -using Microsoft.Extensions.DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; namespace Plugin.Abstractions { diff --git a/samples/aspnetcore/Abstractions/IPluginLink.cs b/samples/aspnetcore/Abstractions/IPluginLink.cs index 048b490..f9e6ba4 100644 --- a/samples/aspnetcore/Abstractions/IPluginLink.cs +++ b/samples/aspnetcore/Abstractions/IPluginLink.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + namespace Plugin.Abstractions { public interface IPluginLink diff --git a/samples/aspnetcore/MainWebApp/Pages/Index.cshtml.cs b/samples/aspnetcore/MainWebApp/Pages/Index.cshtml.cs index 6122919..e0a6dfc 100644 --- a/samples/aspnetcore/MainWebApp/Pages/Index.cshtml.cs +++ b/samples/aspnetcore/MainWebApp/Pages/Index.cshtml.cs @@ -1,8 +1,8 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Plugin.Abstractions; diff --git a/samples/aspnetcore/MainWebApp/Program.cs b/samples/aspnetcore/MainWebApp/Program.cs index 24741d4..300580a 100644 --- a/samples/aspnetcore/MainWebApp/Program.cs +++ b/samples/aspnetcore/MainWebApp/Program.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; namespace MainWebApp { diff --git a/samples/aspnetcore/MainWebApp/Startup.cs b/samples/aspnetcore/MainWebApp/Startup.cs index cb231c2..8dd9e1c 100644 --- a/samples/aspnetcore/MainWebApp/Startup.cs +++ b/samples/aspnetcore/MainWebApp/Startup.cs @@ -1,12 +1,13 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; -using System.Linq; using System.IO; -using System.Threading.Tasks; +using System.Linq; using McMaster.NETCore.Plugins; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Plugin.Abstractions; @@ -14,7 +15,7 @@ namespace MainWebApp { public class Startup { - private List _plugins = new List(); + private readonly List _plugins = new(); public Startup() { diff --git a/samples/aspnetcore/WebAppPlugin1/WebPlugin1.cs b/samples/aspnetcore/WebAppPlugin1/WebPlugin1.cs index db3b54f..a3c956e 100644 --- a/samples/aspnetcore/WebAppPlugin1/WebPlugin1.cs +++ b/samples/aspnetcore/WebAppPlugin1/WebPlugin1.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; diff --git a/samples/aspnetcore/WebAppPlugin2/WebPlugin2.cs b/samples/aspnetcore/WebAppPlugin2/WebPlugin2.cs index 2cf6886..13d2bf5 100644 --- a/samples/aspnetcore/WebAppPlugin2/WebPlugin2.cs +++ b/samples/aspnetcore/WebAppPlugin2/WebPlugin2.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; diff --git a/samples/dependency-injection/DI.HostApp/Program.cs b/samples/dependency-injection/DI.HostApp/Program.cs index 40facd9..cc4cbd9 100644 --- a/samples/dependency-injection/DI.HostApp/Program.cs +++ b/samples/dependency-injection/DI.HostApp/Program.cs @@ -1,9 +1,12 @@ -using McMaster.NETCore.Plugins; -using Microsoft.Extensions.DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Collections.Generic; using System.IO; using System.Linq; +using McMaster.NETCore.Plugins; +using Microsoft.Extensions.DependencyInjection; namespace DependencyInjection { diff --git a/samples/dependency-injection/DI.SharedAbstractions/Fruit.cs b/samples/dependency-injection/DI.SharedAbstractions/Fruit.cs index e6bf938..d7ad871 100644 --- a/samples/dependency-injection/DI.SharedAbstractions/Fruit.cs +++ b/samples/dependency-injection/DI.SharedAbstractions/Fruit.cs @@ -1,4 +1,7 @@ -namespace DependencyInjection +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace DependencyInjection { public class Fruit { diff --git a/samples/dependency-injection/DI.SharedAbstractions/IFruitConsumer.cs b/samples/dependency-injection/DI.SharedAbstractions/IFruitConsumer.cs index c865305..aec332b 100644 --- a/samples/dependency-injection/DI.SharedAbstractions/IFruitConsumer.cs +++ b/samples/dependency-injection/DI.SharedAbstractions/IFruitConsumer.cs @@ -1,4 +1,7 @@ -namespace DependencyInjection +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace DependencyInjection { public interface IFruitConsumer { diff --git a/samples/dependency-injection/DI.SharedAbstractions/IFruitProducer.cs b/samples/dependency-injection/DI.SharedAbstractions/IFruitProducer.cs index e1812b3..5fa9f44 100644 --- a/samples/dependency-injection/DI.SharedAbstractions/IFruitProducer.cs +++ b/samples/dependency-injection/DI.SharedAbstractions/IFruitProducer.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Collections.Generic; namespace DependencyInjection diff --git a/samples/dependency-injection/DI.SharedAbstractions/IPluginFactory.cs b/samples/dependency-injection/DI.SharedAbstractions/IPluginFactory.cs index ccaa008..bbfbfa7 100644 --- a/samples/dependency-injection/DI.SharedAbstractions/IPluginFactory.cs +++ b/samples/dependency-injection/DI.SharedAbstractions/IPluginFactory.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Extensions.DependencyInjection; namespace DependencyInjection { diff --git a/samples/dependency-injection/MyPlugin1/MyFruitProducer.cs b/samples/dependency-injection/MyPlugin1/MyFruitProducer.cs index 1d74a56..a923d7a 100644 --- a/samples/dependency-injection/MyPlugin1/MyFruitProducer.cs +++ b/samples/dependency-injection/MyPlugin1/MyFruitProducer.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Collections.Generic; using DependencyInjection; diff --git a/samples/dependency-injection/MyPlugin1/PluginConfiguration.cs b/samples/dependency-injection/MyPlugin1/PluginConfiguration.cs index 6ee7bcf..ae780cd 100644 --- a/samples/dependency-injection/MyPlugin1/PluginConfiguration.cs +++ b/samples/dependency-injection/MyPlugin1/PluginConfiguration.cs @@ -1,4 +1,7 @@ -using DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using DependencyInjection; using Microsoft.Extensions.DependencyInjection; namespace MyPlugin1 diff --git a/samples/dependency-injection/MyPlugin2/MyFruitConsumer.cs b/samples/dependency-injection/MyPlugin2/MyFruitConsumer.cs index 4155ee6..3ccfc65 100644 --- a/samples/dependency-injection/MyPlugin2/MyFruitConsumer.cs +++ b/samples/dependency-injection/MyPlugin2/MyFruitConsumer.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using DependencyInjection; diff --git a/samples/dependency-injection/MyPlugin2/PluginConfiguration.cs b/samples/dependency-injection/MyPlugin2/PluginConfiguration.cs index 661523a..42e29a8 100644 --- a/samples/dependency-injection/MyPlugin2/PluginConfiguration.cs +++ b/samples/dependency-injection/MyPlugin2/PluginConfiguration.cs @@ -1,4 +1,7 @@ -using DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using DependencyInjection; using Microsoft.Extensions.DependencyInjection; namespace MyPlugin2 diff --git a/samples/dynamic-implementation/Contracts/Fruit.cs b/samples/dynamic-implementation/Contracts/Fruit.cs index 60e586a..0439f4d 100644 --- a/samples/dynamic-implementation/Contracts/Fruit.cs +++ b/samples/dynamic-implementation/Contracts/Fruit.cs @@ -1,7 +1,10 @@ -namespace Contracts +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Contracts { public class Fruit { - public string Name { get; set; } + public string? Name { get; set; } } } diff --git a/samples/dynamic-implementation/Contracts/IFruitService.cs b/samples/dynamic-implementation/Contracts/IFruitService.cs index ec71f95..2313606 100644 --- a/samples/dynamic-implementation/Contracts/IFruitService.cs +++ b/samples/dynamic-implementation/Contracts/IFruitService.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; namespace Contracts { diff --git a/samples/dynamic-implementation/Contracts/IMixerService.cs b/samples/dynamic-implementation/Contracts/IMixerService.cs index 4455a84..44fc8ac 100644 --- a/samples/dynamic-implementation/Contracts/IMixerService.cs +++ b/samples/dynamic-implementation/Contracts/IMixerService.cs @@ -1,4 +1,7 @@ -namespace Contracts +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Contracts { public interface IMixerService { diff --git a/samples/dynamic-implementation/Contracts/IPluginFactory.cs b/samples/dynamic-implementation/Contracts/IPluginFactory.cs index 7adad05..2887a23 100644 --- a/samples/dynamic-implementation/Contracts/IPluginFactory.cs +++ b/samples/dynamic-implementation/Contracts/IPluginFactory.cs @@ -1,4 +1,7 @@ -using Microsoft.Extensions.DependencyInjection; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Extensions.DependencyInjection; namespace Contracts { diff --git a/samples/dynamic-implementation/Host/Program.cs b/samples/dynamic-implementation/Host/Program.cs index 81baabe..9d6dbe9 100644 --- a/samples/dynamic-implementation/Host/Program.cs +++ b/samples/dynamic-implementation/Host/Program.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,9 +11,9 @@ namespace Host { - class Program + internal class Program { - static void Main(string[] args) + public static void Main(string[] args) { var services = new ServiceCollection(); var loaders = GetPluginLoaders(); @@ -20,7 +23,7 @@ static void Main(string[] args) var serviceProvider = services.BuildServiceProvider(); var mixer = serviceProvider.GetRequiredService(); - var result = mixer.MixIt(); + mixer.MixIt(); } private static List GetPluginLoaders() diff --git a/samples/dynamic-implementation/Mixer/MixerPlugin.cs b/samples/dynamic-implementation/Mixer/MixerPlugin.cs index 8637019..2de93df 100644 --- a/samples/dynamic-implementation/Mixer/MixerPlugin.cs +++ b/samples/dynamic-implementation/Mixer/MixerPlugin.cs @@ -1,4 +1,7 @@ -using Contracts; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Contracts; using Microsoft.Extensions.DependencyInjection; namespace Mixer diff --git a/samples/dynamic-implementation/Mixer/MixerService.cs b/samples/dynamic-implementation/Mixer/MixerService.cs index 2c3da78..c494703 100644 --- a/samples/dynamic-implementation/Mixer/MixerService.cs +++ b/samples/dynamic-implementation/Mixer/MixerService.cs @@ -1,4 +1,7 @@ -using System.Linq; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; using Contracts; namespace Mixer diff --git a/samples/dynamic-implementation/Mixer/StandardFruiteService.cs b/samples/dynamic-implementation/Mixer/StandardFruiteService.cs index fb6d49a..cff7fe5 100644 --- a/samples/dynamic-implementation/Mixer/StandardFruiteService.cs +++ b/samples/dynamic-implementation/Mixer/StandardFruiteService.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; using Contracts; namespace Mixer diff --git a/samples/dynamic-implementation/ServiceImplementation/OverrideFruiteService.cs b/samples/dynamic-implementation/ServiceImplementation/OverrideFruiteService.cs index 2bc88c4..0e4e503 100644 --- a/samples/dynamic-implementation/ServiceImplementation/OverrideFruiteService.cs +++ b/samples/dynamic-implementation/ServiceImplementation/OverrideFruiteService.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; using Contracts; namespace ServiceImplementation diff --git a/samples/dynamic-implementation/ServiceImplementation/OverridePlugin.cs b/samples/dynamic-implementation/ServiceImplementation/OverridePlugin.cs index 9f0cedc..73f1f18 100644 --- a/samples/dynamic-implementation/ServiceImplementation/OverridePlugin.cs +++ b/samples/dynamic-implementation/ServiceImplementation/OverridePlugin.cs @@ -1,4 +1,7 @@ -using Contracts; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Contracts; using Microsoft.Extensions.DependencyInjection; namespace ServiceImplementation diff --git a/samples/hello-world/HostApp/Program.cs b/samples/hello-world/HostApp/Program.cs index 2316f1d..d8364bb 100644 --- a/samples/hello-world/HostApp/Program.cs +++ b/samples/hello-world/HostApp/Program.cs @@ -1,8 +1,10 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using McMaster.NETCore.Plugins; namespace HelloWorld diff --git a/samples/hello-world/MyPlugin/MyPlugin1.cs b/samples/hello-world/MyPlugin/MyPlugin1.cs index 90b263d..bd5e461 100644 --- a/samples/hello-world/MyPlugin/MyPlugin1.cs +++ b/samples/hello-world/MyPlugin/MyPlugin1.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using HelloWorld; namespace MyPlugin diff --git a/samples/hello-world/PluginContract/IPlugin.cs b/samples/hello-world/PluginContract/IPlugin.cs index ce8c99b..317badf 100644 --- a/samples/hello-world/PluginContract/IPlugin.cs +++ b/samples/hello-world/PluginContract/IPlugin.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + namespace HelloWorld { /// diff --git a/samples/hot-reload/HotReloadApp/Program.cs b/samples/hot-reload/HotReloadApp/Program.cs index c857d5d..aff5a4b 100644 --- a/samples/hot-reload/HotReloadApp/Program.cs +++ b/samples/hot-reload/HotReloadApp/Program.cs @@ -1,13 +1,16 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Threading; using System.Threading.Tasks; using McMaster.NETCore.Plugins; namespace HostApp { - class Program + internal class Program { - static async Task Main(string[] args) + public static async Task Main(string[] args) { var pluginPath = args[0]; var loader = PluginLoader.CreateFromAssemblyFile(pluginPath, diff --git a/samples/hot-reload/TimestampedPlugin/InfoDisplayer.cs b/samples/hot-reload/TimestampedPlugin/InfoDisplayer.cs index 812cec8..7e0b6a1 100644 --- a/samples/hot-reload/TimestampedPlugin/InfoDisplayer.cs +++ b/samples/hot-reload/TimestampedPlugin/InfoDisplayer.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Linq; using System.Reflection; using Microsoft.Data.Sqlite; diff --git a/src/Plugins/Internal/Debouncer.cs b/src/Plugins/Internal/Debouncer.cs index 0afe179..dfc409a 100644 --- a/src/Plugins/Internal/Debouncer.cs +++ b/src/Plugins/Internal/Debouncer.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Threading; using System.Threading.Tasks; @@ -6,7 +9,7 @@ namespace McMaster.NETCore.Plugins.Internal { internal class Debouncer : IDisposable { - private readonly CancellationTokenSource _cts = new CancellationTokenSource(); + private readonly CancellationTokenSource _cts = new(); private readonly TimeSpan _waitTime; private int _counter; diff --git a/src/Plugins/Loader/AssemblyLoadContextBuilder.cs b/src/Plugins/Loader/AssemblyLoadContextBuilder.cs index 3252342..03329bd 100644 --- a/src/Plugins/Loader/AssemblyLoadContextBuilder.cs +++ b/src/Plugins/Loader/AssemblyLoadContextBuilder.cs @@ -16,13 +16,13 @@ namespace McMaster.NETCore.Plugins.Loader /// public class AssemblyLoadContextBuilder { - private readonly List _additionalProbingPaths = new List(); - private readonly List _resourceProbingPaths = new List(); - private readonly List _resourceProbingSubpaths = new List(); - private readonly Dictionary _managedLibraries = new Dictionary(StringComparer.Ordinal); - private readonly Dictionary _nativeLibraries = new Dictionary(StringComparer.Ordinal); - private readonly HashSet _privateAssemblies = new HashSet(StringComparer.Ordinal); - private readonly HashSet _defaultAssemblies = new HashSet(StringComparer.Ordinal); + private readonly List _additionalProbingPaths = new(); + private readonly List _resourceProbingPaths = new(); + private readonly List _resourceProbingSubpaths = new(); + private readonly Dictionary _managedLibraries = new(StringComparer.Ordinal); + private readonly Dictionary _nativeLibraries = new(StringComparer.Ordinal); + private readonly HashSet _privateAssemblies = new(StringComparer.Ordinal); + private readonly HashSet _defaultAssemblies = new(StringComparer.Ordinal); private AssemblyLoadContext _defaultLoadContext = AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()) ?? AssemblyLoadContext.Default; private string? _mainAssemblyPath; private bool _preferDefaultLoadContext; diff --git a/src/Plugins/Loader/DependencyContextExtensions.cs b/src/Plugins/Loader/DependencyContextExtensions.cs index 78d5141..fc2d0a9 100644 --- a/src/Plugins/Loader/DependencyContextExtensions.cs +++ b/src/Plugins/Loader/DependencyContextExtensions.cs @@ -82,19 +82,14 @@ private static string GetFallbackRid() return "any"; } - switch (RuntimeInformation.OSArchitecture) + return RuntimeInformation.OSArchitecture switch { - case Architecture.X86: - return ridBase + "-x86"; - case Architecture.X64: - return ridBase + "-x64"; - case Architecture.Arm: - return ridBase + "-arm"; - case Architecture.Arm64: - return ridBase + "-arm64"; - } - - return ridBase; + Architecture.X86 => ridBase + "-x86", + Architecture.X64 => ridBase + "-x64", + Architecture.Arm => ridBase + "-arm", + Architecture.Arm64 => ridBase + "-arm64", + _ => ridBase, + }; } /// diff --git a/src/Plugins/Loader/ManagedLoadContext.cs b/src/Plugins/Loader/ManagedLoadContext.cs index f606047..f8e2b40 100644 --- a/src/Plugins/Loader/ManagedLoadContext.cs +++ b/src/Plugins/Loader/ManagedLoadContext.cs @@ -28,8 +28,8 @@ internal class ManagedLoadContext : AssemblyLoadContext private readonly IReadOnlyCollection _additionalProbingPaths; private readonly bool _preferDefaultLoadContext; private readonly string[] _resourceRoots; - private bool _loadInMemory; - private AssemblyLoadContext _defaultLoadContext; + private readonly bool _loadInMemory; + private readonly AssemblyLoadContext _defaultLoadContext; #if FEATURE_NATIVE_RESOLVER private readonly AssemblyDependencyResolver _dependencyResolver; #endif diff --git a/src/Plugins/Loader/RuntimeConfigExtensions.cs b/src/Plugins/Loader/RuntimeConfigExtensions.cs index 237efbd..679c56a 100644 --- a/src/Plugins/Loader/RuntimeConfigExtensions.cs +++ b/src/Plugins/Loader/RuntimeConfigExtensions.cs @@ -15,7 +15,7 @@ namespace McMaster.NETCore.Plugins.Loader public static class RuntimeConfigExtensions { private const string JsonExt = ".json"; - private static readonly JsonSerializerOptions s_serializerOptions = new JsonSerializerOptions() + private static readonly JsonSerializerOptions s_serializerOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; diff --git a/src/Plugins/PluginLoader.cs b/src/Plugins/PluginLoader.cs index 2b3b2cb..a0b638c 100644 --- a/src/Plugins/PluginLoader.cs +++ b/src/Plugins/PluginLoader.cs @@ -40,7 +40,7 @@ public class PluginLoader : IDisposable /// /// A loader. public static PluginLoader CreateFromAssemblyFile(string assemblyFile, bool isUnloadable, Type[] sharedTypes) - => CreateFromAssemblyFile(assemblyFile,isUnloadable, sharedTypes, _ => { }); + => CreateFromAssemblyFile(assemblyFile, isUnloadable, sharedTypes, _ => { }); /// /// Create a plugin loader for an assembly file. @@ -233,8 +233,10 @@ private void StartFileWatcher() _debouncer = new Debouncer(_config.ReloadDelay); - _fileWatcher = new FileSystemWatcher(); - _fileWatcher.Path = Path.GetDirectoryName(_config.MainAssemblyPath); + _fileWatcher = new FileSystemWatcher + { + Path = Path.GetDirectoryName(_config.MainAssemblyPath) + }; _fileWatcher.Changed += OnFileChanged; _fileWatcher.Filter = "*.dll"; _fileWatcher.NotifyFilter = NotifyFilters.LastWrite; @@ -364,7 +366,7 @@ private static AssemblyLoadContextBuilder CreateLoadContextBuilder(PluginConfig { builder.EnableUnloading(); } - + if (config.LoadInMemory) { builder.PreloadAssembliesIntoMemory(); diff --git a/src/Plugins/Properties/AssemblyInfo.cs b/src/Plugins/Properties/AssemblyInfo.cs index b21db73..7ed81e4 100644 --- a/src/Plugins/Properties/AssemblyInfo.cs +++ b/src/Plugins/Properties/AssemblyInfo.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("McMaster.NETCore.Plugins.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001df0eba4297c8ffdf114a13714ad787744619dfb18e29191703f6f782d6a09e4a4cac35b8c768cbbd9ade8197bc0f66ec66fabc9071a206c8060af8b7a332236968d3ee44b90bd2f30d0edcb6150555c6f8d988e48234debaf2d427a08d7c06ba1343411142dc8ac996f7f7dbe0e93d13f17a7624db5400510e6144b0fd683b9")] diff --git a/test/Plugins.Tests/BasicAssemblyLoaderTests.cs b/test/Plugins.Tests/BasicAssemblyLoaderTests.cs index ba5d170..dd23498 100644 --- a/test/Plugins.Tests/BasicAssemblyLoaderTests.cs +++ b/test/Plugins.Tests/BasicAssemblyLoaderTests.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Reflection; using System.Runtime.CompilerServices; diff --git a/test/Plugins.Tests/DebouncerTests.cs b/test/Plugins.Tests/DebouncerTests.cs index b70d0b8..67994f6 100644 --- a/test/Plugins.Tests/DebouncerTests.cs +++ b/test/Plugins.Tests/DebouncerTests.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Threading.Tasks; using McMaster.NETCore.Plugins.Internal; using Xunit; @@ -43,7 +46,7 @@ public async Task OnlyLastActionIsInvoked() string? invokedAction = null; var debouncer = new Debouncer(TimeSpan.FromSeconds(.1)); - foreach (var action in new[]{"a", "b", "c"}) + foreach (var action in new[] { "a", "b", "c" }) { debouncer.Execute(() => invokedAction = action); } diff --git a/test/Plugins.Tests/ManageLoadContextTests.cs b/test/Plugins.Tests/ManageLoadContextTests.cs index 4aa127f..bd40aae 100644 --- a/test/Plugins.Tests/ManageLoadContextTests.cs +++ b/test/Plugins.Tests/ManageLoadContextTests.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.IO; using System.Reflection; using System.Runtime.Loader; @@ -40,20 +43,20 @@ public void ContextsHavePrivateVersionsByDefault() [Fact] public void ItCanDowngradeUnifiedTypes() { - var samplePath = TestResources.GetTestProjectAssembly("NetCoreApp20App"); + var samplePath = TestResources.GetTestProjectAssembly("NetCoreApp2App"); var defaultLoader = new AssemblyLoadContextBuilder() .SetMainAssemblyPath(samplePath) .AddProbingPath(samplePath) .PreferDefaultLoadContext(false) - .AddDependencyContext(Path.Combine(Path.GetDirectoryName(samplePath)!, "NetCoreApp20App.deps.json")) + .AddDependencyContext(Path.Combine(Path.GetDirectoryName(samplePath)!, "NetCoreApp2App.deps.json")) .Build(); var unifedLoader = new AssemblyLoadContextBuilder() .SetMainAssemblyPath(samplePath) .AddProbingPath(samplePath) .PreferDefaultLoadContext(true) - .AddDependencyContext(Path.Combine(Path.GetDirectoryName(samplePath)!, "NetCoreApp20App.deps.json")) + .AddDependencyContext(Path.Combine(Path.GetDirectoryName(samplePath)!, "NetCoreApp2App.deps.json")) .Build(); Assert.Equal(new Version("2.0.0.0"), LoadAssembly(defaultLoader, "Test.Referenced.Library").GetName().Version); diff --git a/test/Plugins.Tests/PrivateDependencyTests.cs b/test/Plugins.Tests/PrivateDependencyTests.cs index 91b70f2..c9c56f5 100644 --- a/test/Plugins.Tests/PrivateDependencyTests.cs +++ b/test/Plugins.Tests/PrivateDependencyTests.cs @@ -1,6 +1,8 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Reflection; -using System.Runtime.Loader; using Xunit; namespace McMaster.NETCore.Plugins.Tests diff --git a/test/Plugins.Tests/SharedTypesTests.cs b/test/Plugins.Tests/SharedTypesTests.cs index 295b83c..0e717ae 100644 --- a/test/Plugins.Tests/SharedTypesTests.cs +++ b/test/Plugins.Tests/SharedTypesTests.cs @@ -1,6 +1,8 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Loader; @@ -58,19 +60,19 @@ public void TransitiveAssembliesOfSharedTypesAreResolved() /// This is a carefully crafted example which tests /// whether the library can be used outside of the default load context /// (). - /// + /// /// It works by loading a plugin (that gets loaded into another ALC) /// which in turn loads its own plugins using the library. If said plugin /// can successfully share its own types, the test should work. /// [Fact] public void NonDefaultLoadContextsAreSupported() - { + { /* The loaded plugin here will be in its own ALC. * It will load its own plugins, which are not known to this ALC. * Then this ALC will ask that ALC if it managed to successfully its own plugins. */ - + using var loader = PluginLoader.CreateFromAssemblyFile(TestResources.GetTestProjectAssembly("WithOwnPlugins"), new[] { typeof(IWithOwnPlugins) }); var assembly = loader.LoadDefaultAssembly(); var configType = assembly.GetType("WithOwnPlugins.WithOwnPlugins", throwOnError: true)!; diff --git a/test/Plugins.Tests/Utilities/TestProjectReferenceAttribute.cs b/test/Plugins.Tests/Utilities/TestProjectReferenceAttribute.cs index 5661ecc..4246596 100644 --- a/test/Plugins.Tests/Utilities/TestProjectReferenceAttribute.cs +++ b/test/Plugins.Tests/Utilities/TestProjectReferenceAttribute.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; namespace McMaster.NETCore.Plugins.Tests { diff --git a/test/Plugins.Tests/Utilities/TestResources.cs b/test/Plugins.Tests/Utilities/TestResources.cs index 05b529a..43f17d4 100644 --- a/test/Plugins.Tests/Utilities/TestResources.cs +++ b/test/Plugins.Tests/Utilities/TestResources.cs @@ -1,4 +1,7 @@ -using System.Linq; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; using System.Reflection; namespace McMaster.NETCore.Plugins.Tests diff --git a/test/TestProjects/Banana/Banana.cs b/test/TestProjects/Banana/Banana.cs index f5b6100..3f670b7 100644 --- a/test/TestProjects/Banana/Banana.cs +++ b/test/TestProjects/Banana/Banana.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Test.Referenced.Library; namespace Test diff --git a/test/TestProjects/DrawingApp/Finder.cs b/test/TestProjects/DrawingApp/Finder.cs index 0bc0953..727f7ef 100644 --- a/test/TestProjects/DrawingApp/Finder.cs +++ b/test/TestProjects/DrawingApp/Finder.cs @@ -1,10 +1,13 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Drawing.Printing; public class Finder { public static string FindDrawingAssembly() { - var pd = new PrintDocument(); + _ = new PrintDocument(); return typeof(PrintDocument).Assembly.CodeBase; } } diff --git a/test/TestProjects/JsonNet10/Class1.cs b/test/TestProjects/JsonNet10/Class1.cs index 6839f44..a2133d3 100644 --- a/test/TestProjects/JsonNet10/Class1.cs +++ b/test/TestProjects/JsonNet10/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace JsonNet10 { diff --git a/test/TestProjects/JsonNet11/Class1.cs b/test/TestProjects/JsonNet11/Class1.cs index f9cca8f..889ca1f 100644 --- a/test/TestProjects/JsonNet11/Class1.cs +++ b/test/TestProjects/JsonNet11/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace JsonNet11 { diff --git a/test/TestProjects/JsonNet9/Class1.cs b/test/TestProjects/JsonNet9/Class1.cs index fa02b03..345849f 100644 --- a/test/TestProjects/JsonNet9/Class1.cs +++ b/test/TestProjects/JsonNet9/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace JsonNet9 { diff --git a/test/TestProjects/NativeDependency/NativeDependencyLoader.cs b/test/TestProjects/NativeDependency/NativeDependencyLoader.cs index 31c1260..b584f73 100644 --- a/test/TestProjects/NativeDependency/NativeDependencyLoader.cs +++ b/test/TestProjects/NativeDependency/NativeDependencyLoader.cs @@ -1,6 +1,9 @@ -using System; -using System.IO; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Data.SQLite; +using System.IO; namespace NativeDependency { diff --git a/test/TestProjects/NetStandardClassLib/Class1.cs b/test/TestProjects/NetStandardClassLib/Class1.cs index 487c26b..24bd016 100644 --- a/test/TestProjects/NetStandardClassLib/Class1.cs +++ b/test/TestProjects/NetStandardClassLib/Class1.cs @@ -1,4 +1,7 @@ -namespace NetStandardClassLib +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace NetStandardClassLib { public class Class1 { diff --git "a/test/TestProjects/Pl\303\241tano/Pl\303\241tano.cs" "b/test/TestProjects/Pl\303\241tano/Pl\303\241tano.cs" index ed584af..c655f44 100644 --- "a/test/TestProjects/Pl\303\241tano/Pl\303\241tano.cs" +++ "b/test/TestProjects/Pl\303\241tano/Pl\303\241tano.cs" @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Plátano; using Test.Referenced.Library; diff --git a/test/TestProjects/PowerShellPlugin/Program.cs b/test/TestProjects/PowerShellPlugin/Program.cs index b7e8b2b..eec7c42 100644 --- a/test/TestProjects/PowerShellPlugin/Program.cs +++ b/test/TestProjects/PowerShellPlugin/Program.cs @@ -1,24 +1,25 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Management.Automation; namespace PowerShellPlugin { - class Program + internal class Program { - static void Main(string[] args) + public static void Main(string[] args) { Console.WriteLine(GetGreeting()); } public static string GetGreeting() { - using (var ps = PowerShell.Create()) - { - var type = typeof(AliasAttribute); - // Console.WriteLine(type.Assembly.Location); - var results = ps.AddScript("Write-Output hello").Invoke(); - return results[0].ToString(); - } + using var ps = PowerShell.Create(); + var type = typeof(AliasAttribute); + // Console.WriteLine(type.Assembly.Location); + var results = ps.AddScript("Write-Output hello").Invoke(); + return results[0].ToString(); } } } diff --git a/test/TestProjects/ReferencedLibv1/Class1.cs b/test/TestProjects/ReferencedLibv1/Class1.cs index d6e60d1..3ad31b6 100644 --- a/test/TestProjects/ReferencedLibv1/Class1.cs +++ b/test/TestProjects/ReferencedLibv1/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Test.Referenced.Library { diff --git a/test/TestProjects/ReferencedLibv1/IFruit.cs b/test/TestProjects/ReferencedLibv1/IFruit.cs index 33d8d0b..5aee614 100644 --- a/test/TestProjects/ReferencedLibv1/IFruit.cs +++ b/test/TestProjects/ReferencedLibv1/IFruit.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Test.Referenced.Library { diff --git a/test/TestProjects/ReferencedLibv2/Class1.cs b/test/TestProjects/ReferencedLibv2/Class1.cs index 28b4730..af12c3e 100644 --- a/test/TestProjects/ReferencedLibv2/Class1.cs +++ b/test/TestProjects/ReferencedLibv2/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Test.Referenced.Library { diff --git a/test/TestProjects/SharedAbstraction.v1/SharedType.cs b/test/TestProjects/SharedAbstraction.v1/SharedType.cs index 2510ae5..869345d 100644 --- a/test/TestProjects/SharedAbstraction.v1/SharedType.cs +++ b/test/TestProjects/SharedAbstraction.v1/SharedType.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using Test.Transitive; diff --git a/test/TestProjects/SqlClientApp/Program.cs b/test/TestProjects/SqlClientApp/Program.cs index c009412..79fc076 100644 --- a/test/TestProjects/SqlClientApp/Program.cs +++ b/test/TestProjects/SqlClientApp/Program.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Data.SqlClient; namespace SqlClientApp @@ -14,11 +16,9 @@ public static bool Run() { try { - using (var client = new SqlConnection(@"Data Source=(localdb)\mssqllocaldb;Integrated Security=True")) - { - client.Open(); - return !string.IsNullOrEmpty(client.ServerVersion); - } + using var client = new SqlConnection(@"Data Source=(localdb)\mssqllocaldb;Integrated Security=True"); + client.Open(); + return !string.IsNullOrEmpty(client.ServerVersion); } catch (SqlException ex) when (ex.Number == -2) // -2 means SQL timeout { diff --git a/test/TestProjects/Strawberry/Strawberry.cs b/test/TestProjects/Strawberry/Strawberry.cs index 2b41ec2..47a3c87 100644 --- a/test/TestProjects/Strawberry/Strawberry.cs +++ b/test/TestProjects/Strawberry/Strawberry.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Test.Referenced.Library; namespace Test diff --git a/test/TestProjects/TransitiveDep.v1/TransitiveSharedType.cs b/test/TestProjects/TransitiveDep.v1/TransitiveSharedType.cs index 48c442c..5f4ca47 100644 --- a/test/TestProjects/TransitiveDep.v1/TransitiveSharedType.cs +++ b/test/TestProjects/TransitiveDep.v1/TransitiveSharedType.cs @@ -1,3 +1,6 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + namespace Test.Transitive { public class TransitiveSharedType { } diff --git a/test/TestProjects/TransitivePlugin/PluginConfig.cs b/test/TestProjects/TransitivePlugin/PluginConfig.cs index a533f63..7e4b420 100644 --- a/test/TestProjects/TransitivePlugin/PluginConfig.cs +++ b/test/TestProjects/TransitivePlugin/PluginConfig.cs @@ -1,9 +1,12 @@ +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using Test.Transitive; namespace TransitivePlugin { public class PluginConfig { - public TransitiveSharedType GetTransitiveType() => new TransitiveSharedType(); + public TransitiveSharedType GetTransitiveType() => new(); } } diff --git a/test/TestProjects/WithOurPluginsPluginA/Class1.cs b/test/TestProjects/WithOurPluginsPluginA/Class1.cs index da54c7d..b399b66 100644 --- a/test/TestProjects/WithOurPluginsPluginA/Class1.cs +++ b/test/TestProjects/WithOurPluginsPluginA/Class1.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using WithOurPluginsPluginContract; namespace WithOurPluginsPluginA diff --git a/test/TestProjects/WithOurPluginsPluginB/Class1.cs b/test/TestProjects/WithOurPluginsPluginB/Class1.cs index 45d2851..9e1bae6 100644 --- a/test/TestProjects/WithOurPluginsPluginB/Class1.cs +++ b/test/TestProjects/WithOurPluginsPluginB/Class1.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using WithOurPluginsPluginContract; namespace WithOurPluginsPluginB diff --git a/test/TestProjects/WithOurPluginsPluginContract/ISayHello.cs b/test/TestProjects/WithOurPluginsPluginContract/ISayHello.cs index 0d8973b..31e885c 100644 --- a/test/TestProjects/WithOurPluginsPluginContract/ISayHello.cs +++ b/test/TestProjects/WithOurPluginsPluginContract/ISayHello.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace WithOurPluginsPluginContract { diff --git a/test/TestProjects/WithOwnPlugins/WithOwnPlugins.cs b/test/TestProjects/WithOwnPlugins/WithOwnPlugins.cs index 11e30b3..db9a3e4 100644 --- a/test/TestProjects/WithOwnPlugins/WithOwnPlugins.cs +++ b/test/TestProjects/WithOwnPlugins/WithOwnPlugins.cs @@ -1,4 +1,4 @@ -// Copyright (c) Nate McMaster. +// Copyright (c) Nate McMaster. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/test/TestProjects/WithOwnPluginsContract/IWithOwnPlugins.cs b/test/TestProjects/WithOwnPluginsContract/IWithOwnPlugins.cs index 2e650c1..097e150 100644 --- a/test/TestProjects/WithOwnPluginsContract/IWithOwnPlugins.cs +++ b/test/TestProjects/WithOwnPluginsContract/IWithOwnPlugins.cs @@ -1,4 +1,7 @@ -using System.Runtime.Loader; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Runtime.Loader; namespace WithOwnPluginsContract { diff --git a/test/TestProjects/XunitSample/Class1.cs b/test/TestProjects/XunitSample/Class1.cs index e58f13c..b124389 100644 --- a/test/TestProjects/XunitSample/Class1.cs +++ b/test/TestProjects/XunitSample/Class1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Nate McMaster. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace XunitSample {