Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用mono.cecil注入HTTP调用_Mono_Mono.cecil - Fatal编程技术网

如何使用mono.cecil注入HTTP调用

如何使用mono.cecil注入HTTP调用,mono,mono.cecil,Mono,Mono.cecil,我尝试使用mono cecil推送HTTP调用,但在校准时遇到问题 C#中的实际代码: 转换使用 此代码生成这些IL | > IL_0000: ldloc V_2 | > IL_0000: ldloc V_1 | > IL_0000: callvirt System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage> System.Net.Http.HttpCli

我尝试使用mono cecil推送HTTP调用,但在校准时遇到问题 C#中的实际代码:

转换使用

此代码生成这些IL

|       > IL_0000: ldloc V_2
|       > IL_0000: ldloc V_1
|       > IL_0000: callvirt System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage> System.Net.Http.HttpClient::GetAsync(System.String)
|       > IL_0000: stloc V_3

这里有人能帮忙吗…

你能分享一下吗?嗨@Pawełukasik,谢谢你的回复。我能够注入HTTP请求。如果是这样,请共享您的解决方案,以便将来的搜索者可以使用它。@AmitKumar我也对实际修复感兴趣(我是Cecilifier的作者);我几乎可以肯定这与async有关(Cecilifier对此没有任何支持)。顺便说一句,你可以创建一个要点并使用一个url,如:Canyoushare?Hi@Pawełukasik,谢谢你的回复。我能够注入HTTP请求。如果是这样,请共享您的解决方案,以便将来的搜索者可以使用它。@AmitKumar我也对实际修复感兴趣(我是Cecilifier的作者);我几乎可以肯定这与async有关(Cecilifier对此没有任何支持)。顺便说一句,您可以创建要点并使用url,如:
    var lv_res32 = new VariableDefinition(assembly.MainModule.ImportReference(typeof(System.Threading.Tasks.Task)));
    CodeInsight_WorkThreadFunction_.Body.Variables.Add(lv_res32);
    var Ldloc33 = il_CodeInsight_WorkThreadFunction_.Create(OpCodes.Ldloc, lv_client13);
    il_CodeInsight_WorkThreadFunction_.Append(Ldloc33);
    var Callvirt34 = il_CodeInsight_WorkThreadFunction_.Create(OpCodes.Callvirt, assembly.MainModule.ImportReference(TypeHelpers.ResolveMethod("System.Net.Http", "System.Net.Http.HttpClient", "GetAsync",System.Reflection.BindingFlags.Default|System.Reflection.BindingFlags.Instance|System.Reflection.BindingFlags.Public,"", "System.String")));
    var Ldloc35 = il_CodeInsight_WorkThreadFunction_.Create(OpCodes.Ldloc, lv_urlParameters10);
    il_CodeInsight_WorkThreadFunction_.Append(Ldloc35);
    il_CodeInsight_WorkThreadFunction_.Append(Callvirt34);
    var Stloc36 = il_CodeInsight_WorkThreadFunction_.Create(OpCodes.Stloc, lv_res32);
    il_CodeInsight_WorkThreadFunction_.Append(Stloc36);
|       > IL_0000: ldloc V_2
|       > IL_0000: ldloc V_1
|       > IL_0000: callvirt System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage> System.Net.Http.HttpClient::GetAsync(System.String)
|       > IL_0000: stloc V_3
Hello from OtherUnhandled exception. System.InvalidProgramException: Common Language Runtime detected 
an invalid program.
   at QualityInsight.CodeInsight.WorkThreadFunction()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()