diff --git a/src/Wolverine/Runtime/WolverineRuntime.HostService.cs b/src/Wolverine/Runtime/WolverineRuntime.HostService.cs
index bd37c3f3b..c5cd5450c 100644
--- a/src/Wolverine/Runtime/WolverineRuntime.HostService.cs
+++ b/src/Wolverine/Runtime/WolverineRuntime.HostService.cs
@@ -47,6 +47,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
// Has to be done before initializing the storage
Handlers.AddMessageHandler(typeof(IAgentCommand), new AgentCommandHandler(this));
+
if (Options.Durability.DurabilityAgentEnabled)
{
foreach (var store in await _stores.Value.FindAllAsync())
@@ -175,6 +176,12 @@ public async Task StopAsync(CancellationToken cancellationToken)
return;
}
+ if (DynamicCodeBuilder.WithinCodegenCommand)
+ {
+ // Don't do anything here
+ return;
+ }
+
await _agentCancellation.CancelAsync();
_hasStopped = true;
diff --git a/src/Wolverine/Wolverine.csproj b/src/Wolverine/Wolverine.csproj
index c70211121..34aa4a355 100644
--- a/src/Wolverine/Wolverine.csproj
+++ b/src/Wolverine/Wolverine.csproj
@@ -4,7 +4,7 @@
WolverineFx
-
+