|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Diagnostics.DataContractReader.Data;
internal sealed class Object : IData<Object>
{
static Object IData<Object>.Create(Target target, TargetPointer address) => new Object(target, address);
public Object(Target target, TargetPointer address)
{
Target.TypeInfo type = target.GetTypeInfo(DataType.Object);
Address = address;
MethodTable = target.ProcessedData.GetOrAdd<Data.MethodTable>(target.ReadPointerField(address, type, "m_pMethTab"));
Data = address + (type.Size ?? throw new InvalidOperationException("Object size must be known"));
}
public TargetPointer Address { get; init; }
public MethodTable MethodTable { get; init; }
public TargetPointer Data { get; init; }
}
|