Esempio n. 1
0
        public static ObjectValue Create(object obj, ObjectPath path)
        {
            var sessionOptions = DebuggingService.GetUserOptions();
            var options        = sessionOptions.EvaluationOptions;
            var context        = new CSharpInteractiveEvaluationContext(options);

            context.Adapter   = objectValueAdapter;
            context.Evaluator = new CSharpInteractiveExpressionEvaluator();

            var source = new CSharpInteractiveObjectValueSource(path.Join("."), obj, context);

            try {
                // Cannot update top level value types from the REPL so mark the top level objects as read-only.
                var         flags = ObjectValueFlags.ReadOnly;
                ObjectValue value = objectValueAdapter.CreateObjectValue(context, source, path, obj, flags);
                AttachStackFrame(value, sessionOptions);
                return(value);
            } catch (Exception ex) {
                return(ObjectValue.CreateError(null, path, string.Empty, ex.Message, ObjectValueFlags.None));
            }
        }