Exemplo n.º 1
0
        public void IntegerObjectClrType()
        {
            IClrHeap heap        = Process.Current.ClrRuntimes.Single().Heap;
            Module   typesModule = Module.All.Single(m => m.Name == "Types");
            Variable s_i         = typesModule.GetVariable("Types.s_i");

            Assert.Equal(42, (int)s_i);
            Assert.Contains(s_i, heap.EnumerateObjects());
        }
Exemplo n.º 2
0
        public void FieldNameAndValueTests()
        {
            IClrHeap heap        = Process.Current.ClrRuntimes.Single().Heap;
            Module   typesModule = Module.All.Single(m => m.Name == "Types");
            CodeType fooType     = CodeType.Create("Foo", typesModule);
            Variable s_foo       = typesModule.GetVariable("Types.s_foo");

            Assert.Equal(fooType, s_foo.GetCodeType());
            Assert.Equal(42, (int)s_foo.GetField("i"));
            Assert.Equal("string", new ClrString(s_foo.GetField("s")).Text);
            Assert.True((bool)s_foo.GetField("b"));
            Assert.Equal(4.2f, (float)s_foo.GetField("f"));
            Assert.Equal(8.4, (double)s_foo.GetField("d"));
            Assert.Contains(s_foo, heap.EnumerateObjects());
        }
Exemplo n.º 3
0
        public void HeapEnumeration()
        {
            IClrRuntime runtime = Process.Current.ClrRuntimes.Single();
            IClrHeap    heap    = runtime.Heap;

            Assert.NotNull(heap);
            Assert.NotNull(runtime.GCThreads);
            Assert.True(runtime.HeapCount > 0);
            Assert.NotNull(runtime.ToString());
            Assert.True(heap.CanWalkHeap);

            int count = 0;

            foreach (Variable variable in heap.EnumerateObjects())
            {
                Assert.NotNull(variable);
                count++;
            }

            Assert.True(count > 0);
        }