feat: validate plugin dependencies during plugin loading - #41
Merged
Conversation
Introduce the DependsOnAttribute to declare plugin dependencies and validate them during plugin loading. PluginLoader now throws PluginDependencyException when a declared dependency cannot be resolved from the configured plugin list.
Add sample plugins demonstrating how to declare plugin dependencies using DependsOnAttribute and how plugins can consume services registered by other plugins.
Remove the redundant normalization of configured plugin names. CPluginConfigurationBase already guarantees that plugin files use the .dll extension, so only dependency names declared with DependsOnAttribute need to be normalized before comparison.
Add tests covering plugin dependency validation. Verify that PluginLoader throws PluginDependencyException when a dependency is missing and successfully loads plugins when all declared dependencies are configured.
DevD4v3
force-pushed
the
feature/plugin-dependencies
branch
from
July 29, 2026 19:38
db20e57 to
7c5ba39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces support for plugin dependencies through the new
DependsOnAttribute.During plugin loading, CPlugin.Net validates that every declared dependency is also present in the configured plugin list. If a dependency cannot be resolved, plugin loading fails with a
PluginDependencyException.This helps detect configuration errors early and prevents plugins from running with missing requirements.
Usage
If the
Weaponsplugin is not listed in the plugin configuration (for example, inappsettings.jsonor a.envfile),PluginLoader.Load(...)throws:Changes
Motivation
Some plugins require services, commands, or other components provided by another plugin.
Previously, these relationships were implicit and configuration errors were only discovered later at runtime.
With this change, plugin dependencies become explicit and are validated during plugin loading, allowing configuration issues to be detected immediately with a clear error message.