Upgrade to .net 10

This commit is contained in:
2025-11-12 12:48:17 +01:00
parent e27ea92aa4
commit 55bc2277b6
9 changed files with 28 additions and 37 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'
dotnet-version: '10.x'
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.1
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'
dotnet-version: '10.x'
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.1
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 Macocian Alexandru Victor
Copyright (c) 2025 Macocian Alexandru Victor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
@@ -17,6 +17,6 @@
</Target>
<ItemGroup>
<PackageReference Include="SystemExtensions.NetStandard" Version="1.6.2" />
<PackageReference Include="SystemExtensions.NetStandard" Version="1.6.12" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
+2 -7
View File
@@ -2,12 +2,7 @@
namespace Plumsy.Exceptions;
public sealed class PluginLoadException : Exception
public sealed class PluginLoadException(string? message, Exception? innerException, PluginEntry plugin) : Exception(message, innerException)
{
public PluginEntry Plugin { get; }
public PluginLoadException(string? message, Exception? innerException, PluginEntry plugin) : base(message, innerException)
{
this.Plugin = plugin;
}
public PluginEntry Plugin { get; } = plugin;
}
+2 -2
View File
@@ -2,8 +2,8 @@
public sealed class PluginEntry
{
public string Name { get; init; }
public string Path { get; init; }
public required string Name { get; init; }
public required string Path { get; init; }
internal PluginEntry()
{
+13 -17
View File
@@ -10,26 +10,21 @@ using System.Runtime.CompilerServices;
namespace Plumsy;
public sealed class PluginManager
public sealed class PluginManager(string pluginsBaseDirectory)
{
private static readonly object Lock = new();
private readonly string pluginsBaseDirectory;
private readonly List<IEnvironmentVersionValidator> environmentVersionValidators = new();
private readonly List<IMetadataValidator> metadataValidators = new();
private readonly List<ITypeDefinitionsValidator> typeDefinitionsValidators = new();
private readonly List<IAssemblyLoadedCallback> assemblyLoadCallbacks = new();
private readonly List<IDependencyResolver> dependencyResolvers = new();
private readonly string pluginsBaseDirectory = Path.GetFullPath(pluginsBaseDirectory);
private readonly List<IEnvironmentVersionValidator> environmentVersionValidators = [];
private readonly List<IMetadataValidator> metadataValidators = [];
private readonly List<ITypeDefinitionsValidator> typeDefinitionsValidators = [];
private readonly List<IAssemblyLoadedCallback> assemblyLoadCallbacks = [];
private readonly List<IDependencyResolver> dependencyResolvers = [];
private bool locked = false;
private bool attachedDomainEvents = false;
private bool forceLoadDependencies = true;
public PluginManager(string pluginsBaseDirectory)
{
this.pluginsBaseDirectory = Path.GetFullPath(pluginsBaseDirectory);
}
public PluginManager WithEnvironmentVersionValidator(IEnvironmentVersionValidator environmentVersionValidator)
{
if (this.locked)
@@ -172,8 +167,8 @@ public sealed class PluginManager
}
var success = false;
PluginLoadException pluginLoadException = default!;
Assembly assembly = default!;
PluginLoadException? pluginLoadException = default;
Assembly? assembly = default;
try
{
assembly = Assembly.LoadFrom(plugin.Path);
@@ -203,7 +198,7 @@ public sealed class PluginManager
}
else
{
yield return new PluginLoadOperation.ExceptionEncountered { Exception = pluginLoadException!, PluginEntry = plugin };
yield return new PluginLoadOperation.ExceptionEncountered { Exception = pluginLoadException ?? new Exception("Unexpected exception while loading plugin"), PluginEntry = plugin };
}
}
}
@@ -216,7 +211,7 @@ public sealed class PluginManager
}
}
private Assembly AssemblyResolve(object? _, ResolveEventArgs resolveEventArgs)
private Assembly? AssemblyResolve(object? _, ResolveEventArgs resolveEventArgs)
{
foreach (var resolver in this.dependencyResolvers)
{
@@ -227,7 +222,8 @@ public sealed class PluginManager
}
}
throw new InvalidOperationException($"Unable to resolve dependency {resolveEventArgs.Name}. Requesting assembly: {resolveEventArgs.RequestingAssembly}");
// Return null to allow the runtime to continue with its default resolution mechanisms
return null;
}
private bool ValidatePlugin(string path, out PluginEntry? plugin)
+5 -5
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -10,10 +10,10 @@
<Company />
<Product></Product>
<Description>Plugin management library.</Description>
<AssemblyVersion>1.1</AssemblyVersion>
<FileVersion>1.1</FileVersion>
<AssemblyVersion>1.2</AssemblyVersion>
<FileVersion>1.2</FileVersion>
<PackageProjectUrl>https://github.com/AlexMacocian/Plum</PackageProjectUrl>
<Version>1.1</Version>
<Version>1.2</Version>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
@@ -21,7 +21,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Reflection.Metadata" Version="7.0.2" />
<PackageReference Include="System.Reflection.Metadata" Version="10.0.0" />
</ItemGroup>
<ItemGroup>