Skip il that can't be interpreted

This commit is contained in:
Ben Adams 2017-11-30 15:17:03 +00:00
parent 4f2a8602e9
commit 9945e82cb7
2 changed files with 21 additions and 14 deletions

View File

@ -11,7 +11,7 @@
<RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<Version>0.0.5</Version>
<Version>0.0.6</Version>
</PropertyGroup>
<PropertyGroup>

View File

@ -335,27 +335,34 @@ namespace System.Diagnostics
}
}
var rawIL = methodBody?.GetILAsByteArray();
if (rawIL == null) continue;
var reader = new ILReader(rawIL);
while (reader.Read(candidateMethod))
try
{
if (reader.Operand is MethodBase mb)
var rawIL = methodBody?.GetILAsByteArray();
if (rawIL == null) continue;
var reader = new ILReader(rawIL);
while (reader.Read(candidateMethod))
{
if (method == mb || (matchHint != null && method.Name.Contains(matchHint)))
if (reader.Operand is MethodBase mb)
{
if (kind == GeneratedNameKind.LambdaMethod)
if (method == mb || (matchHint != null && method.Name.Contains(matchHint)))
{
GetOrdinal(method, ref ordinal);
}
if (kind == GeneratedNameKind.LambdaMethod)
{
GetOrdinal(method, ref ordinal);
}
method = candidateMethod;
type = method.DeclaringType;
return true;
method = candidateMethod;
type = method.DeclaringType;
return true;
}
}
}
}
catch
{
// https://github.com/benaadams/Ben.Demystifier/issues/32
// Skip methods where il can't be interpreted
}
}
return false;