提交 ac2c8dd4 编写于 作者: K Kevin_H

Update EE to handle EnC updates (add/remove locals) by flowing the method...

Update EE to handle EnC updates (add/remove locals) by flowing the method version through to ISymUnmanagedReader.GetMethodByVersion.

(fixes #1017468 & #1030053)
***NO_CI***
 (changeset 1347348)
上级 78834998
......@@ -285,7 +285,7 @@ public static void SkipRecord(byte[] bytes, ref int offset, int size)
/// For each namespace enclosing the method, a list of import strings, innermost to outermost.
/// There should always be at least one entry, for the global namespace.
/// </returns>
public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrings(this ISymUnmanagedReader reader, int methodToken, out ImmutableArray<string> externAliasStrings)
public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrings(this ISymUnmanagedReader reader, int methodToken, int methodVersion, out ImmutableArray<string> externAliasStrings)
{
externAliasStrings = default(ImmutableArray<string>);
......@@ -349,7 +349,7 @@ public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrin
int moduleInfoMethodToken;
ReadForwardToModuleRecord(bytes, ref offset, size, out moduleInfoMethodToken);
ImmutableArray<string> allModuleInfoImportStrings = reader.GetBaselineMethod(moduleInfoMethodToken).GetImportStrings();
ImmutableArray<string> allModuleInfoImportStrings = reader.GetMethodByVersion(moduleInfoMethodToken, methodVersion).GetImportStrings();
ArrayBuilder<string> externAliasBuilder = ArrayBuilder<string>.GetInstance();
foreach(string importString in allModuleInfoImportStrings)
{
......@@ -372,7 +372,7 @@ public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrin
return default(ImmutableArray<ImmutableArray<string>>);
}
ImmutableArray<string> importStrings = reader.GetBaselineMethod(methodToken).GetImportStrings();
ImmutableArray<string> importStrings = reader.GetMethodByVersion(methodToken, methodVersion).GetImportStrings();
int numImportStrings = importStrings.Length;
ArrayBuilder<ImmutableArray<string>> resultBuilder = ArrayBuilder<ImmutableArray<string>>.GetInstance(groupSizes.Length);
......@@ -440,9 +440,9 @@ public static ImmutableArray<ImmutableArray<string>> GetCSharpGroupedImportStrin
/// <returns>
/// A list of import strings. There should always be at least one entry, for the global namespace.
/// </returns>
public static ImmutableArray<string> GetVisualBasicImportStrings(this ISymUnmanagedReader reader, int methodToken)
public static ImmutableArray<string> GetVisualBasicImportStrings(this ISymUnmanagedReader reader, int methodToken, int methodVersion)
{
ImmutableArray<string> importStrings = reader.GetBaselineMethod(methodToken).GetImportStrings();
ImmutableArray<string> importStrings = reader.GetMethodByVersion(methodToken, methodVersion).GetImportStrings();
// Follow at most one forward link.
if (importStrings.Length > 0)
......@@ -458,7 +458,7 @@ public static ImmutableArray<string> GetVisualBasicImportStrings(this ISymUnmana
int tempMethodToken;
if (int.TryParse(importString.Substring(1), NumberStyles.None, CultureInfo.InvariantCulture, out tempMethodToken))
{
return reader.GetBaselineMethod(tempMethodToken).GetImportStrings();
return reader.GetMethodByVersion(tempMethodToken, methodVersion).GetImportStrings();
}
}
}
......
......@@ -11,9 +11,14 @@ internal static class SymUnmanagedReaderExtensions
private const int E_FAIL = unchecked((int)0x80004005);
internal static ISymUnmanagedMethod GetBaselineMethod(this ISymUnmanagedReader reader, int methodToken)
{
return reader.GetMethodByVersion(methodToken, methodVersion: 1);
}
internal static ISymUnmanagedMethod GetMethodByVersion(this ISymUnmanagedReader reader, int methodToken, int methodVersion)
{
ISymUnmanagedMethod method = null;
int hr = reader.GetMethodByVersion(methodToken, 1, out method);
int hr = reader.GetMethodByVersion(methodToken, methodVersion, out method);
if (hr == E_FAIL)
{
// method has no symbol info
......@@ -21,7 +26,7 @@ internal static ISymUnmanagedMethod GetBaselineMethod(this ISymUnmanagedReader r
}
else if (hr != 0)
{
throw new ArgumentException(string.Format("Invalid method token '0x{0:x8}' (hresult = 0x{1:x8})", methodToken, hr), "methodToken");
throw new ArgumentException(string.Format("Invalid method token '0x{0:x8}' or version '{1}' (hresult = 0x{2:x8})", methodToken, methodVersion, hr), "methodToken");
}
Debug.Assert(method != null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册