Skip to content

Commit d108be1

Browse files
authored
[cdac] Remove GetMethodDescData fallback to legacy DAC (#110702)
- Make cDAC `GetMethodDescData` implementation stop delegating to the legacy DAC as a fallback. - Debug.Assert cDAC/DAC hresults on failure
1 parent da7e06c commit d108be1

File tree

3 files changed

+196
-153
lines changed

3 files changed

+196
-153
lines changed

src/native/managed/cdacreader/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public TypeHandle GetTypeHandle(TargetPointer typeHandlePointer)
267267

268268
if ((addressLowBits != TypeHandleBits.MethodTable) && (addressLowBits != TypeHandleBits.TypeDesc))
269269
{
270-
throw new InvalidOperationException("Invalid type handle pointer");
270+
throw new ArgumentException("Invalid type handle pointer", nameof(typeHandlePointer));
271271
}
272272

273273
// if we already validated this address, return a handle
@@ -306,7 +306,7 @@ public TypeHandle GetTypeHandle(TargetPointer typeHandlePointer)
306306
// Otherwse, get ready to validate
307307
if (!_typeValidation.TryValidateMethodTablePointer(methodTablePointer))
308308
{
309-
throw new InvalidOperationException("Invalid method table pointer");
309+
throw new ArgumentException("Invalid method table pointer", nameof(typeHandlePointer));
310310
}
311311
// ok, we validated it, cache the data and add the MethodTable_1 struct to the dictionary
312312
Data.MethodTable trustedMethodTableData = _target.ProcessedData.GetOrAdd<Data.MethodTable>(methodTablePointer);
@@ -636,7 +636,7 @@ public MethodDescHandle GetMethodDescHandle(TargetPointer methodDescPointer)
636636

637637
if (!_methodValidation.ValidateMethodDescPointer(methodDescPointer, out TargetPointer methodDescChunkPointer))
638638
{
639-
throw new InvalidOperationException("Invalid method desc pointer");
639+
throw new ArgumentException("Invalid method desc pointer", nameof(methodDescPointer));
640640
}
641641

642642
// ok, we validated it, cache the data and add the MethodDesc struct to the dictionary

0 commit comments

Comments
 (0)