Exemple #1
0
        public CommandEntityVM(EntityDescriptor descriptor)
        {
            Descriptor = descriptor;

            EntityValue = new ValueVM <object>(
                Descriptor.DeserializeFromString,
                Descriptor.SerializeToString,
                (v) => CommonUtils.TryOrDefault(() => Descriptor.ValidateValueRange(v)));
            EntityValue.ModelValue = descriptor.DefaultEntity.Value;
        }
Exemple #2
0
		public void WriteExpander(ValueVM vm) {
			if (vm.LazyLoading)
				output.Write("+", TextTokenType.Text);
			else if (vm.Children.Count == 0) {
				// VS prints nothing
			}
			else if (vm.IsExpanded)
				output.Write("-", TextTokenType.Text);
			else
				output.Write("+", TextTokenType.Text);
		}
Exemple #3
0
		public void WriteExpander(ValueVM vm) {
			if (vm.LazyLoading)
				output.Write(BoxedTextColor.Text, "+");
			else if (vm.Children.Count == 0) {
				// VS prints nothing
			}
			else if (vm.IsExpanded)
				output.Write(BoxedTextColor.Text, "-");
			else
				output.Write(BoxedTextColor.Text, "+");
		}
Exemple #4
0
 public void WriteExpander(ValueVM vm)
 {
     if (vm.LazyLoading)
     {
         output.Write("+", TextTokenType.Text);
     }
     else if (vm.Children.Count == 0)
     {
         // VS prints nothing
     }
     else if (vm.IsExpanded)
     {
         output.Write("-", TextTokenType.Text);
     }
     else
     {
         output.Write("+", TextTokenType.Text);
     }
 }
Exemple #5
0
 public void WriteExpander(ValueVM vm)
 {
     if (vm.LazyLoading)
     {
         output.Write(BoxedTextColor.Text, "+");
     }
     else if (vm.Children.Count == 0)
     {
         // VS prints nothing
     }
     else if (vm.IsExpanded)
     {
         output.Write(BoxedTextColor.Text, "-");
     }
     else
     {
         output.Write(BoxedTextColor.Text, "+");
     }
 }
Exemple #6
0
        void InitializeLocals(LocalInitType initType)
        {
            if (!IsEnabled || DebugManager.Instance.ProcessState != DebuggerProcessState.Stopped)
            {
                ClearAllLocals();
                return;
            }

            if (initType == LocalInitType.Simple)
            {
                // Property eval has completed, don't do a thing
                return;
            }

            var       thread  = StackFrameManager.Instance.SelectedThread;
            var       frame   = StackFrameManager.Instance.SelectedFrame;
            int       frameNo = StackFrameManager.Instance.SelectedFrameNumber;
            DnProcess process;

            if (thread == null)
            {
                process = DebugManager.Instance.Debugger.Processes.FirstOrDefault();
                thread  = process == null ? null : process.Threads.FirstOrDefault();
            }
            else
            {
                process = thread.Process;
            }

            var newFrameInfo = new FrameInfo(this, thread, process, frame, frameNo);

            if (frameInfo == null || !frameInfo.Equals(newFrameInfo))
            {
                ClearAndDisposeChildren();
            }
            frameInfo = newFrameInfo;

            CorValue[] corArgs, corLocals;
            if (frame != null)
            {
                corArgs   = frame.ILArguments.ToArray();
                corLocals = frame.ILLocals.ToArray();
            }
            else
            {
                corArgs = corLocals = new CorValue[0];
            }
            var args   = new List <ICorValueHolder>(corArgs.Length);
            var locals = new List <ICorValueHolder>(corLocals.Length);

            for (int i = 0; i < corArgs.Length; i++)
            {
                args.Add(new LocArgCorValueHolder(true, this, corArgs[i], i));
            }
            for (int i = 0; i < corLocals.Length; i++)
            {
                locals.Add(new LocArgCorValueHolder(false, this, corLocals[i], i));
            }

            var exValue       = thread == null ? null : thread.CorThread.CurrentException;
            var exValueHolder = exValue == null ? null : new DummyCorValueHolder(exValue);

            int numGenArgs = frameInfo.ValueContext.GenericTypeArguments.Count + frameInfo.ValueContext.GenericMethodArguments.Count;

            if (!CanReuseChildren(exValueHolder, args.Count, locals.Count, numGenArgs))
            {
                ClearAndDisposeChildren();
            }

            if (rootNode.Children.Count == 0)
            {
                hasInitializedArgNames              = false;
                hasInitializedLocalNames            = false;
                hasInitializedArgNamesFromMetadata  = false;
                hasInitializedLocalNamesFromPdbFile = false;
            }

            List <TypeSig> argTypes;
            List <TypeSig> localTypes;

            if (frame != null)
            {
                frame.GetArgAndLocalTypes(out argTypes, out localTypes);
            }
            else
            {
                argTypes = localTypes = new List <TypeSig>();
            }

            if (rootNode.Children.Count == 0)
            {
                if (exValueHolder != null)
                {
                    rootNode.Children.Add(new CorValueVM(frameInfo.ValueContext, exValueHolder, null, new ExceptionValueType()));
                }
                for (int i = 0; i < args.Count; i++)
                {
                    rootNode.Children.Add(new CorValueVM(frameInfo.ValueContext, args[i], Read(argTypes, i), new ArgumentValueType(i)));
                }
                for (int i = 0; i < locals.Count; i++)
                {
                    rootNode.Children.Add(new CorValueVM(frameInfo.ValueContext, locals[i], Read(localTypes, i), new LocalValueType(i)));
                }
                if (numGenArgs != 0)
                {
                    rootNode.Children.Add(new TypeVariablesValueVM(frameInfo.ValueContext));
                }
            }
            else
            {
                int index = 0;

                if (exValueHolder != null)
                {
                    if (index < rootNode.Children.Count && NormalValueVM.IsType <ExceptionValueType>(rootNode.Children[index]))
                    {
                        ((CorValueVM)rootNode.Children[index++]).Reinitialize(frameInfo.ValueContext, exValueHolder, null);
                    }
                    else
                    {
                        rootNode.Children.Insert(index++, new CorValueVM(frameInfo.ValueContext, exValueHolder, null, new ExceptionValueType()));
                    }
                }
                else
                {
                    if (index < rootNode.Children.Count && NormalValueVM.IsType <ExceptionValueType>(rootNode.Children[index]))
                    {
                        ValueVM.DisposeAndRemoveAt(rootNode, index);
                    }
                }

                for (int i = 0; i < args.Count; i++, index++)
                {
                    ((CorValueVM)rootNode.Children[index]).Reinitialize(frameInfo.ValueContext, args[i], Read(argTypes, i));
                }
                for (int i = 0; i < locals.Count; i++, index++)
                {
                    ((CorValueVM)rootNode.Children[index]).Reinitialize(frameInfo.ValueContext, locals[i], Read(localTypes, i));
                }
                if (numGenArgs != 0)
                {
                    ((TypeVariablesValueVM)rootNode.Children[index++]).Reinitialize(frameInfo.ValueContext);
                }
            }

            InitializeLocalAndArgNames();
            if (!hasInitializedArgNames && !hasInitializedArgNamesFromMetadata)
            {
                InitializeArgNamesFromMetadata();
            }
            if (!hasInitializedLocalNames && !hasInitializedLocalNamesFromPdbFile)
            {
                InitializeLocalNamesFromPdbFile();
            }
        }
Exemple #7
0
 void ClearAndDisposeChildren()
 {
     ValueVM.ClearAndDisposeChildren(rootNode);
 }
Exemple #8
0
 static bool CanExpand(ValueVM vm) => vm != null && !vm.IsExpanded && (vm.LazyLoading || vm.Children.Count > 0);
Exemple #9
0
 void ClearAndDisposeChildren() => ValueVM.ClearAndDisposeChildren(Root);
Exemple #10
0
		public void WriteType(ValueVM vm) {
			Write(vm.CachedOutputType);
		}
Exemple #11
0
		public void WriteValue(ValueVM vm) {
			Write(vm.CachedOutputValue);
		}
Exemple #12
0
		public void WriteName(ValueVM vm) {
			vm.WriteName(output);
		}
Exemple #13
0
 public void WriteType(ValueVM vm)
 {
     Write(vm.CachedOutputType);
 }
Exemple #14
0
 public void WriteValue(ValueVM vm)
 {
     Write(vm.CachedOutputValue);
 }
Exemple #15
0
 public void WriteName(ValueVM vm)
 {
     vm.WriteName(output);
 }
Exemple #16
0
 public NameValuePair(string name, string units, ValueVM <T> value)
 {
     Name  = name ?? throw new ArgumentNullException(nameof(name));
     Units = units;
     Value = value ?? throw new ArgumentNullException(nameof(value));
 }