private Instruction AppendDebugWrite(Instruction instruction, ILProcessor processor, string message) { return(instruction .AppendLdstr(processor, message) .Append(processor.Create(OpCodes.Call, ModuleDefinition.ImportMethod(References.DebugWriteLineMethod)), processor)); }
public static Instruction AppendDebugWrite(this Instruction instruction, ILProcessor processor, string message, ModuleDefinition module) { return (instruction.AppendLdstr(processor, message) .Append(processor.Create(OpCodes.Call, module.ImportMethod(typeof(Debug), "WriteLine", new[] { typeof(string) })), processor)); }
private Instruction InjectCacheKeyCreatedCode(MethodDefinition methodDefinition, Instruction current, ILProcessor processor, int cacheKeyIndex) { if (LogDebugOutput) { // Call Debug.WriteLine with CacheKey current = current.AppendLdstr(processor, "CacheKey created: {0}") .AppendLdloc(processor, cacheKeyIndex) .Append( processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod <string>("Format", new[] { typeof(string), typeof(object) })), processor) .Append( processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod(typeof(Debug), "WriteLine", new[] { typeof(string) })), processor); } return(current); }
private static Instruction InjectCacheKeyCreatedCode(BaseModuleWeaver weaver, MethodDefinition methodDefinition, Instruction current, ILProcessor processor, int cacheKeyIndex) { // Call Debug.WriteLine with CacheKey current = current .AppendLdstr(processor, "CacheKey created: {0}") .AppendLdcI4(processor, 1) .Append(processor.Create(OpCodes.Newarr, weaver.ModuleDefinition.TypeSystem.Object), processor) .AppendDup(processor) .AppendLdcI4(processor, 0) .AppendLdloc(processor, cacheKeyIndex) .Append(processor.Create(OpCodes.Stelem_Ref), processor) .Append(processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod(ReferenceFinder.StringFormatMethod)), processor) .Append(processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod(ReferenceFinder.DebugWriteLineMethod)), processor); return(current); }
private static Instruction AppendDebugWrite(BaseModuleWeaver weaver, Instruction instruction, ILProcessor processor, string message) { return(instruction .AppendLdstr(processor, message) .Append(processor.Create(OpCodes.Call, weaver.ModuleDefinition.ImportMethod(ReferenceFinder.DebugWriteLineMethod)), processor)); }