abpframework/abp · warning · AbpShutdownException
An error occurred during the shutdown {contributor.GetType()
Error message
An error occurred during the shutdown {contributor.GetType().FullName} phase of the module {module.Type.AssemblyQualifiedName}: {ex.Message}. See the inner exception for details. What it means
Thrown by ModuleManager.ShutdownModulesAsync when contributor.ShutdownAsync throws while shutting down a module (modules are shut down in reverse order). It is wrapped as AbpShutdownException with the original as InnerException. It signals a failure during the async shutdown phase.
Source
Thrown at framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleManager.cs:88
_logger.LogInformation("Initialized all ABP modules.");
}
public virtual async Task ShutdownModulesAsync(ApplicationShutdownContext context)
{
var modules = _moduleContainer.Modules.Reverse().ToList();
foreach (var contributor in _lifecycleContributors)
{
foreach (var module in modules)
{
try
{
await contributor.ShutdownAsync(context, module.Instance);
}
catch (Exception ex)
{
throw new AbpShutdownException($"An error occurred during the shutdown {contributor.GetType().FullName} phase of the module {module.Type.AssemblyQualifiedName}: {ex.Message}. See the inner exception for details.", ex);
}
}
}
}
public void ShutdownModules(ApplicationShutdownContext context)
{
var modules = _moduleContainer.Modules.Reverse().ToList();
foreach (var contributor in _lifecycleContributors)
{
foreach (var module in modules)
{
try
{
contributor.Shutdown(context, module.Instance);
}
catch (Exception ex)View on GitHub (pinned to 7ed43b1931)
Solutions
- Inspect the InnerException for the real cause and fix that disposal/shutdown code.
- Make shutdown logic idempotent and defensive — wrap each resource disposal in its own try/catch so one failure does not abort the rest.
- Ensure resources being shut down were actually initialized (guard against shutting down a partially-initialized module).
- Add cancellation handling so shutdown respects the host token instead of throwing.
Defensive patterns
Strategy: try-catch
Validate before calling
// No pre-check; ensure each module's shutdown logic is guarded internally. // In OnApplicationShutdownAsync, wrap each resource disposal individually.
Try / catch
try { await moduleManager.ShutdownModulesAsync(context); }
catch (AbpShutdownException ex)
{
logger.LogError(ex.InnerException ?? ex, "Module shutdown failed: {Msg}", ex.Message);
// continue shutdown of remaining resources
} Prevention
- Never throw from Dispose/shutdown paths.
- Make shutdown idempotent and cancellation-aware.
- Dispose each resource in its own try/catch so one failure does not cascade.
When it happens
Trigger: Any exception raised inside contributor.ShutdownAsync(ctx, module.Instance) during async application shutdown (e.g. OnApplicationShutdownAsync throwing).
Common situations: A module's OnApplicationShutdownAsync fails flushing/disposing a resource (DB, message bus, file handle), a graceful-disconnect to a broker times out, or a background service throws on stop.
Related errors
- ServiceConfigurationContext is only available in the Configu
- An error occurred during the initialize {contributor.GetType
- Could not find singleton service: {typeof(T).AssemblyQualifi
- Given type is not an ABP module: {moduleType.AssemblyQualifi
- Given module instance ({instance.GetType().AssemblyQualified
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/361b4bd043d2923b.
Report an issue: GitHub.