diff --git a/PorygonSharp/EvalValues/EvalValueCreator.cs b/PorygonSharp/EvalValues/EvalValueCreator.cs index 8383e8f..732da53 100644 --- a/PorygonSharp/EvalValues/EvalValueCreator.cs +++ b/PorygonSharp/EvalValues/EvalValueCreator.cs @@ -43,8 +43,10 @@ namespace PorygonSharp.EvalValues case TypeCode.Object: if (typeof(IList).IsAssignableFrom(type)) return CreateListEvalValue((IList)o, type); - if (!UserDataHandler.IsTypeRegistered(type)) - return null; + if (!UserDataHandler.IsTypeRegistered(type) && !UserDataHandler.TryResolveType(type)) + { + throw new Exception($"Type is not registered for use: {type.FullName}"); + } var typeHash = UserDataHandler.GetTypeId(type); var handle = GCHandle.Alloc(o, GCHandleType.WeakTrackResurrection); return new EvalValue(CreateUserDataEvalValue(typeHash, GCHandle.ToIntPtr(handle)));