提交 25af7060 编写于 作者: A acasey

DevDiv #1108133: Swallow E_NOTIMPL from ISymUnmanaged*

If an ISymUnmanaged* method returns E_NOTIMPL, we should treat that the same way we treat E_FAIL - as an empty result.  An incomplete implementation of ISymUnmanaged* should not prevent the result of expression compilation from succeeding.

Note that we continue to swallow only expected failures - we still want to know about unexpected failures, even at the expense of showing "Internal error" in the UI.

TODO: This change won't actually accomplish anything until the Concord ISymUnmanaged* interfaces are updated to return hresults, rather than throw.

CR: PaNelson, ChuckS (changeset 1399307)
上级 f3414d03
......@@ -47,6 +47,7 @@ internal static class SymUnmanagedReaderExtensions
internal const int S_OK = 0x0;
internal const int S_FALSE = 0x1;
internal const int E_FAIL = unchecked((int)0x80004005);
internal const int E_NOTIMPL = unchecked((int)0x80004001);
private static readonly IntPtr IgnoreIErrorInfo = new IntPtr(-1);
......@@ -233,17 +234,15 @@ public static ISymUnmanagedMethod GetMethodByVersion(this ISymUnmanagedReader re
{
ISymUnmanagedMethod method = null;
int hr = reader.GetMethodByVersion(new SymbolToken(methodToken), methodVersion, out method);
if (hr == E_FAIL)
ThrowExceptionForHR(hr);
if (hr < 0)
{
// method has no symbol info
Debug.WriteLine(string.Format("Invalid method token '0x{0:x8}' or version '{1}' (hresult = 0x{2:x8})", methodToken, methodVersion, hr));
return null;
}
if (hr != 0)
{
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);
return method;
}
......@@ -482,7 +481,8 @@ public static int GetEndOffset(this ISymUnmanagedScope scope)
internal static void ThrowExceptionForHR(int hr)
{
// E_FAIL indicates "no info".
if (hr != E_FAIL)
// E_NOTIMPL indicates a lack of ISymUnmanagedReader support (in a particular implementation).
if (hr < 0 && hr != E_FAIL && hr != E_NOTIMPL)
{
Marshal.ThrowExceptionForHR(hr, IgnoreIErrorInfo);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册