本文整理汇总了C#中IMethod.ToCorFunction方法的典型用法代码示例。如果您正苦于以下问题:C# IMethod.ToCorFunction方法的具体用法?C# IMethod.ToCorFunction怎么用?C# IMethod.ToCorFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethod
的用法示例。
在下文中一共展示了IMethod.ToCorFunction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncNewObject
public static Eval AsyncNewObject(Thread evalThread, IMethod constructor, Value[] constructorArguments)
{
ICorDebugType[] typeArgs = constructor.GetTypeArguments();
ICorDebugValue[] ctorArgs = ValuesAsCorDebug(constructorArguments);
return new Eval(
evalThread,
"New object: " + constructor.FullName,
delegate(Eval eval) {
eval.CorEval2.NewParameterizedObject(
constructor.ToCorFunction(),
(uint)typeArgs.Length, typeArgs,
(uint)ctorArgs.Length, ctorArgs);
}
);
}
示例2: GetIgnoredILRanges
public IEnumerable<ILRange> GetIgnoredILRanges(IMethod method)
{
var symMethod = method.GetSymMethod();
if (symMethod == null)
return null;
int codeSize = (int)method.ToCorFunction().GetILCode().GetSize();
return symMethod.GetSequencePoints(codeSize).Where(p => p.StartLine == 0xFEEFEE).SelectMany(p => p.ILRanges).ToList();
}
示例3: MethodInvokeStarter
/// <exception cref="GetValueException"><c>GetValueException</c>.</exception>
static void MethodInvokeStarter(Eval eval, IMethod method, Value thisValue, Value[] args)
{
List<ICorDebugValue> corArgs = new List<ICorDebugValue>();
args = args ?? new Value[0];
if (args.Length != method.Parameters.Count) {
throw new GetValueException("Invalid parameter count");
}
if (!method.IsStatic) {
if (thisValue == null)
throw new GetValueException("'this' is null");
if (thisValue.IsNull)
throw new GetValueException("Null reference");
corArgs.Add(thisValue.CorValue);
}
for(int i = 0; i < args.Length; i++) {
Value arg = args[i];
IType paramType = method.Parameters[i].Type;
if (!arg.IsNull &&
arg.Type.GetDefinition() != null &&
paramType.GetDefinition() != null &&
!arg.Type.GetDefinition().IsDerivedFrom(paramType.GetDefinition())) {
throw new GetValueException("Inncorrect parameter type. Expected " + paramType.ToString());
}
// It is importatnt to pass the parameter in the correct form (boxed/unboxed)
if (paramType.IsReferenceType == true) {
if (!arg.IsReference)
throw new DebuggerException("Reference expected as method argument");
corArgs.Add(arg.CorValue);
} else {
corArgs.Add(arg.CorGenericValue); // Unbox
}
}
ICorDebugType[] genericArgs = method.GetTypeArguments();
eval.CorEval2.CallParameterizedFunction(
method.ToCorFunction(),
(uint)genericArgs.Length, genericArgs,
(uint)corArgs.Count, corArgs.ToArray()
);
}
示例4: GetSequencePoint
public SequencePoint GetSequencePoint(IMethod method, int iloffset)
{
var symMethod = method.GetSymMethod();
if (symMethod == null)
return null;
// 0xFEEFEE means "code generated by compiler"
int codeSize = (int)method.ToCorFunction().GetILCode().GetSize();
var sequencePoints = symMethod.GetSequencePoints(codeSize);
var realSeqPoints = sequencePoints.Where(p => p.StartLine != 0xFEEFEE);
// Find point for which (ilstart <= iloffset < ilend) or fallback to the next valid sequence point
var sequencePoint = realSeqPoints.FirstOrDefault(p => p.ILRanges.Any(r => r.From <= iloffset && iloffset < r.To)) ??
realSeqPoints.FirstOrDefault(p => iloffset <= p.ILOffset);
if (sequencePoint != null) {
// VB.NET sometimes produces temporary files which it then deletes
// (eg 17d14f5c-a337-4978-8281-53493378c1071.vb)
string name = Path.GetFileName(sequencePoint.Filename);
if (name.Length == 40 && name.EndsWith(".vb")) {
if (name.Substring(0, name.Length - 3).All(c => ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || (c == '-'))) {
return null;
}
}
sequencePoint.Filename = GetSourceCodePath(method.ParentAssembly.GetModule().Process, sequencePoint.Filename);
}
return sequencePoint;
}