diff --git a/src/modules/Elsa.Workflows.Core/Activities/NotFoundActivity.cs b/src/modules/Elsa.Workflows.Core/Activities/NotFoundActivity.cs
index 42cc12550..c3bba3ba7 100644
--- a/src/modules/Elsa.Workflows.Core/Activities/NotFoundActivity.cs
+++ b/src/modules/Elsa.Workflows.Core/Activities/NotFoundActivity.cs
@@ -1,6 +1,7 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Elsa.Workflows.Core.Attributes;
+using Elsa.Workflows.Core.Exceptions;
using JetBrains.Annotations;
namespace Elsa.Workflows.Core.Activities;
@@ -38,4 +39,10 @@ public class NotFoundActivity : CodeActivity
/// The original activity JSON.
///
public string OriginalActivityJson { get; set; } = default!;
+
+ ///
+ protected override void Execute(ActivityExecutionContext context)
+ {
+ throw new ActivityNotFoundException(MissingTypeName, MissingTypeVersion);
+ }
}
\ No newline at end of file
diff --git a/src/modules/Elsa.Workflows.Core/Exceptions/ActivityNotFoundException.cs b/src/modules/Elsa.Workflows.Core/Exceptions/ActivityNotFoundException.cs
new file mode 100644
index 000000000..bc3751bca
--- /dev/null
+++ b/src/modules/Elsa.Workflows.Core/Exceptions/ActivityNotFoundException.cs
@@ -0,0 +1,24 @@
+namespace Elsa.Workflows.Core.Exceptions;
+
+///
+/// Thrown when a NotFoundActivity is executed.
+///
+public class ActivityNotFoundException : Exception
+{
+ ///
+ public ActivityNotFoundException(string missingTypeName, int missingTypeVersion) : base($"Activity type '{missingTypeName}' version '{missingTypeVersion}' could not be found.")
+ {
+ MissingTypeName = missingTypeName;
+ MissingTypeVersion = missingTypeVersion;
+ }
+
+ ///
+ /// The type name of the missing activity type.
+ ///
+ public string MissingTypeName { get; }
+
+ ///
+ /// The version of the missing activity type.
+ ///
+ public int MissingTypeVersion { get; }
+}
\ No newline at end of file