提交 23262d1a 编写于 作者: A acasey

DevDiv #1089591: Handle null in MetadataUtilities.GetScopes

We shouldn't crash just because a PDB is missing information for a specific method.

It looks like the other callers of GetMethodByVersion handle null appropriately.

CR: ChuckS; KevinH (changeset 1387853)
上级 30bf9e42
......@@ -224,6 +224,7 @@ private void WriteMethod(MethodDefinitionHandle methodHandle)
// TODO (tomat): Ideally this would be done in a separate test helper, not in PdbToXml.
// verify ISymUnmanagedMethod APIs:
ISymUnmanagedMethod rawMethod = pdbReader.RawSymbolReader.GetBaselineMethod(token);
Debug.Assert(rawMethod != null, "How did we get an ISymbolMethod without a backing ISymUnmanagedMethod?");
var expectedSlotNames = new Dictionary<int, ImmutableArray<string>>();
WriteLocals(rawMethod, expectedSlotNames);
......
......@@ -396,7 +396,6 @@ public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrin
var method = reader.GetMethodByVersion(methodToken, methodVersion);
if (method == null)
{
// TODO: remove this workaround for DevDiv #1060879.
return default(ImmutableArray<ImmutableArray<string>>);
}
......@@ -666,12 +665,8 @@ private static ImmutableArray<string> GetImportStrings(this ISymUnmanagedMethod
{
if (method == null)
{
// TODO: remove this workaround for DevDiv #1060879.
// If methodToken was updated (because the method we started with forwards to another method),
// we have no way to know what version the new method is on. If it's not the same as the
// version we stared with (e.g. because it has been changed less frequently), then we may not
// find a corresponding ISymUnmanagedMethod.
// Note: The real fix is to not use CDI forwarding in EnC PDBs.
// In rare circumstances (only bad PDBs?) GetMethodByVersion can return null.
// If there's no debug info for the method, then no import strings are available.
return ImmutableArray<string>.Empty;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册