public static Value CreateValue(Thread evalThread, object value) { if (value == null) { ICorDebugClass corClass = evalThread.AppDomain.ObjectType.ToCorDebug().GetClass(); ICorDebugEval corEval = evalThread.CorThread.CreateEval(); ICorDebugValue corValue = corEval.CreateValue((uint)CorElementType.CLASS, corClass); return(new Value(evalThread.AppDomain, corValue)); } else if (value is string) { return(Eval.NewString(evalThread, (string)value)); } else { if (!value.GetType().IsPrimitive) { throw new DebuggerException("Value must be primitve type. Seen " + value.GetType()); } IType type = evalThread.AppDomain.Compilation.FindType(value.GetType()); Value val = Eval.NewObjectNoConstructor(evalThread, type); val.SetPrimitiveValue(evalThread, value); return(val); } }