未验证 提交 07eb95df 编写于 作者: I Ivan Basov 提交者: GitHub

fixing AccessViolationException on ReadMetadataHeader (#24464)

上级 3cda26a4
...@@ -49,6 +49,13 @@ private static IEnumerable<DkmClrModuleInstance> GetModulesInAppDomain(this DkmC ...@@ -49,6 +49,13 @@ private static IEnumerable<DkmClrModuleInstance> GetModulesInAppDomain(this DkmC
DkmClrAppDomain appDomain, DkmClrAppDomain appDomain,
ImmutableArray<MetadataBlock> previousMetadataBlocks) ImmutableArray<MetadataBlock> previousMetadataBlocks)
{ {
// Add a dummy data item to the appdomain to add it to the disposal queue when the debugged process is shutting down.
// This should prevent from attempts to use the Metadata pointer for dead debugged processes.
if (appDomain.GetDataItem<AppDomainLifetimeDataItem>() == null)
{
appDomain.SetDataItem(DkmDataCreationDisposition.CreateNew, new AppDomainLifetimeDataItem());
}
var builder = ArrayBuilder<MetadataBlock>.GetInstance(); var builder = ArrayBuilder<MetadataBlock>.GetInstance();
IntPtr ptr; IntPtr ptr;
uint size; uint size;
...@@ -324,5 +331,7 @@ internal MetadataContextItem(TMetadataContext metadataContext) ...@@ -324,5 +331,7 @@ internal MetadataContextItem(TMetadataContext metadataContext)
this.MetadataContext = metadataContext; this.MetadataContext = metadataContext;
} }
} }
private sealed class AppDomainLifetimeDataItem : DkmDataItem { }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册