elsa-workflows/elsa-core · error · InvalidOperationException
Type ' ' not found.
Error message
Type '{stringValue}' not found. What it means
TypeTypeConverter converts a string (from e.g. TypeConverter-based binding or property grids) into a Type. It first tries the TypeAliasRegistry, then Type.GetType; if both fail it throws InvalidOperationException because the requested type cannot be located.
Solutions
- Use the assembly-qualified type name (e.g. "My.Namespace.MyType, My.Assembly, Version=...")
- Register the alias with the TypeAliasRegistry so the short name resolves
- Ensure the assembly containing the type is loaded before conversion
- Fix typos in the namespace/type name
Example fix
// before
var t = (Type)TypeDescriptor.GetConverter(typeof(Type)).ConvertFrom("MyActivity");
// after
var t = (Type)TypeDescriptor.GetConverter(typeof(Type)).ConvertFrom("MyApp.Activities.MyActivity, MyApp"); Defensive patterns
Strategy: validation
Validate before calling
var resolved = TypeAliasRegistry.GetType(name) ?? Type.GetType(name);
if (resolved is null) throw new ArgumentException($"Type '{name}' is not resolvable.", nameof(name)); Type guard
bool IsResolvableType(string name) => TypeAliasRegistry.GetType(name) is not null || Type.GetType(name, throwOnError: false) is not null;
Try / catch
try { return (Type)converter.ConvertFrom(name); }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Type '") && ex.Message.EndsWith("' not found."))
{ logger.LogWarning("Unknown type name {Name}", name); return null; } Prevention
- Use assembly-qualified names for Type conversions
- Register short aliases in TypeAliasRegistry
- Ensure referenced assemblies are loaded before conversion
- Add unit tests resolving all configured type names
When it happens
Trigger: Calling TypeDescriptor.GetConverter(typeof(Type)).ConvertFrom("Some.Type.Name") (or assigning a string to a Type property through such a converter) with a string that is neither a registered type alias nor an assembly-qualified type name resolvable by Type.GetType.
Common situations: Passing a short type name like "MyActivity" instead of an assembly-qualified name; typo in namespace; the assembly containing the type is not loaded into the AppDomain; alias not registered in TypeAliasRegistry.
Related errors
- Type not found.
- Type does not expose an Add method for .
- Value cannot be null. (Parameter 'type')
- Multiple Invoke methods were found. Use either Invoke or…
- No Invoke methods were found. Use either Invoke or…
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/fbcc44184445a448.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Common/Serialization/TypeTypeConverter.cs:21
using JetBrains.Annotations;
namespace Elsa.Common.Serialization;
[PublicAPI]
public class TypeTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
if (value is string stringValue)
{
if (TypeAliasRegistry.GetType(stringValue) is { } type)
return type;
return Type.GetType(stringValue) ?? throw new InvalidOperationException($"Type '{stringValue}' not found.");
}
return base.ConvertFrom(context, culture, value);
}
public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
{
return destinationType == typeof(string) || base.CanConvertTo(context, destinationType);
}
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
{
if (destinationType == typeof(string) && value is Type type)
{
if (TypeAliasRegistry.TypeAliases.FirstOrDefault(x => x.Value == type).Key is { } alias)
return alias;
return type.AssemblyQualifiedName;
}
return base.ConvertTo(context, culture, value, destinationType);View on GitHub (pinned to fe9217bdfa)