diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml
index 1919c9b..38b8de9 100644
--- a/.github/workflows/cd.yaml
+++ b/.github/workflows/cd.yaml
@@ -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
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2e8b221..c91786d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -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
diff --git a/LICENSE b/LICENSE
index 5863da8..6017819 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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
diff --git a/Plumsy.Tests.SimplePlugin/Plumsy.Tests.SimplePlugin.csproj b/Plumsy.Tests.SimplePlugin/Plumsy.Tests.SimplePlugin.csproj
index 2620e97..c1775b4 100644
--- a/Plumsy.Tests.SimplePlugin/Plumsy.Tests.SimplePlugin.csproj
+++ b/Plumsy.Tests.SimplePlugin/Plumsy.Tests.SimplePlugin.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net10.0
enable
enable
true
@@ -17,6 +17,6 @@
-
+
diff --git a/Plumsy.Tests/Plumsy.Tests.csproj b/Plumsy.Tests/Plumsy.Tests.csproj
index 20f0afc..0968d8d 100644
--- a/Plumsy.Tests/Plumsy.Tests.csproj
+++ b/Plumsy.Tests/Plumsy.Tests.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net10.0
enable
false
diff --git a/Plumsy/Exceptions/PluginLoadException.cs b/Plumsy/Exceptions/PluginLoadException.cs
index 577e1d2..5e26b4c 100644
--- a/Plumsy/Exceptions/PluginLoadException.cs
+++ b/Plumsy/Exceptions/PluginLoadException.cs
@@ -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;
}
diff --git a/Plumsy/Models/PluginEntry.cs b/Plumsy/Models/PluginEntry.cs
index f7f6c6e..aaf104e 100644
--- a/Plumsy/Models/PluginEntry.cs
+++ b/Plumsy/Models/PluginEntry.cs
@@ -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()
{
diff --git a/Plumsy/PluginManager.cs b/Plumsy/PluginManager.cs
index 8e2d475..92211cd 100644
--- a/Plumsy/PluginManager.cs
+++ b/Plumsy/PluginManager.cs
@@ -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 environmentVersionValidators = new();
- private readonly List metadataValidators = new();
- private readonly List typeDefinitionsValidators = new();
- private readonly List assemblyLoadCallbacks = new();
- private readonly List dependencyResolvers = new();
+ private readonly string pluginsBaseDirectory = Path.GetFullPath(pluginsBaseDirectory);
+ private readonly List environmentVersionValidators = [];
+ private readonly List metadataValidators = [];
+ private readonly List typeDefinitionsValidators = [];
+ private readonly List assemblyLoadCallbacks = [];
+ private readonly List 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)
diff --git a/Plumsy/Plumsy.csproj b/Plumsy/Plumsy.csproj
index 47ab454..ed1e7a2 100644
--- a/Plumsy/Plumsy.csproj
+++ b/Plumsy/Plumsy.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net10.0
enable
enable
true
@@ -10,10 +10,10 @@
Plugin management library.
- 1.1
- 1.1
+ 1.2
+ 1.2
https://github.com/AlexMacocian/Plum
- 1.1
+ 1.2
true
true
LICENSE
@@ -21,7 +21,7 @@
-
+