Unity-Technologies/UnityCsReference · error · Exception
Invalid EvalDataParcel. Could not find type {evalDataParcel.
Error message
Invalid EvalDataParcel. Could not find type {evalDataParcel.KnownTypeNames[i]} in for external code execution arguments. What it means
Thrown by ExecuteExternalCode after deserializing EvalDataParcel when a declared known type name cannot be resolved by Type.GetType. The parcel lists known type names (and optional assembly paths) needed to deserialize the method-call arguments; an unresolvable type aborts evaluation.
Source
Thrown at Editor/Mono/Macros/MethodEvaluator.cs:186
}
catch (SerializationException)
{
throw new Exception("Invalid EvalDataParcel data for external code execution.");
}
}
// Prepare list of known types information. Add EnumSurrogate to support int to enum remapping.
var knownTypeNames = new List<Type>() { typeof(MethodEvaluatorSurrogateProvider.EnumSurrogate) };
for (var i = 0; i < evalDataParcel.KnownTypeNames.Length; ++i)
{
// Avoid loading assemblies which are already loaded - empty path means that this type is in system assembly.
if (!string.IsNullOrEmpty(evalDataParcel.KnownTypeAssemblyPaths[i]) && File.Exists(evalDataParcel.KnownTypeAssemblyPaths[i]))
CurrentAssemblies.LoadFromPath(evalDataParcel.KnownTypeAssemblyPaths[i]);
var type = Type.GetType(evalDataParcel.KnownTypeNames[i]);
if (type == null)
{
throw new Exception($"Invalid EvalDataParcel. Could not find type {evalDataParcel.KnownTypeNames[i]} in for external code execution arguments.");
}
knownTypeNames.Add(type);
}
// Now deserialize the main method call data including arguments
EvalRemoteMethodCallParcel evalRemoteMethodCallParcel;
using (var methodStream = new MemoryStream(evalDataParcel.RemoteMethodCallParcelData))
{
// Setting quotas to max to avoid issues with large data.
using var reader = XmlDictionaryReader.CreateTextReader(methodStream, XmlDictionaryReaderQuotas.Max);
var serializer = new DataContractSerializer(typeof(EvalRemoteMethodCallParcel), knownTypeNames);
serializer.SetSerializationSurrogateProvider(new MethodEvaluatorSurrogateProvider());
try
{
evalRemoteMethodCallParcel = (EvalRemoteMethodCallParcel)serializer.ReadObject(reader, true);
}
catch (SerializationException)
{View on GitHub (pinned to 225b0fbdb5)
Solutions
- Ensure all known-type assemblies are built and present at the paths recorded in the parcel.
- Update the parcel's known type names to the current fully-qualified names after a rename/move.
- For non-system types, supply a non-empty assembly path so the evaluator can load it before resolving the name.
Defensive patterns
Strategy: validation
Validate before calling
foreach (var name in knownTypeNames) { if (Type.GetType(name) == null) throw new InvalidOperationException($"Unresolvable known type: {name}"); } Try / catch
try { ExecuteExternalCode(parcel); }
catch (Exception ex) when (ex.Message.Contains("Could not find type")) { Debug.LogError($"Ensure known-type assemblies are present: {ex.Message}"); } Prevention
- Build and ship all known-type assemblies at recorded paths
- Update type names after renames
- Supply non-empty assembly paths for non-system types
When it happens
Trigger: An EvalDataParcel references a known type whose assembly path is missing or whose type name cannot be resolved in the current AppDomain/AssemblyLoadContext. The loop loads the assembly path only if non-empty and the file exists, then asks Type.GetType for the name.
Common situations: Cross-project or cross-version eval where the target type lives in an assembly not present at the recorded path. A renamed/moved type. A known-type assembly path that is empty (intended for system types) but the name does not resolve in mscorlib/System.
Related errors
- The specified assembly file could not be found.
- Expected {o} to be a string or a Type. It is a {o.GetType()}
- Expected {o} to be a string[] or a Type[]. It is a {o.GetTyp
- Method {0}.{1}({2}) not found in assembly {3}!
- Invalid EvalDataParcel data for external code execution.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/47d05e148c4f4fba.
Report an issue: GitHub.