[ Foro de C# ]
No entiendo en donde exactamente tengo un punto muerto (deadlock) en mi código.
En un boton
private async void button_click(){
await Task.WhenAll(T_1(), T_2());
}
private async Task T_1(){
....
string a = web1.Return_T_Scrpit<string>(@"function() SCRIPT CON RETURN");
}
private async Task T_2(){
....
string a = web1.Return_T_Scrpit<string>(@"function() SCRIPT CON RETURN");
}
Y la funcion de ejecucion de script está en modo extensión
public static T Return_T_Script<T>(this ChromiumWebBrowser web, String Script)
{
object data = null;
try
{
String Sc = Make_String(Script);
if (web.IsBrowserInitialized && !web.IsDisposed && !web.Disposing)
{
//ACA TENGO UN PUNTO MUERTO SI LLAMO A TODOS LOS TASK DE MANERA PARALELA
data = web.EvaluateScriptAsync(Sc).ContinueWith<object>(x =>
{
var response = x.Result;
Console.WriteLine("Response String: " + response.ToString());
if (response.Result != null && response.Success)
{
Console.WriteLine("Response String: " + response.Result.ToString());
return response.Result;
}
else
{
return default(T);
}
});
}
else
{
Declas.Log($"{web.IsBrowserInitialized} {web.IsDisposed} {web.Disposing}");
}
return (T)Convert.ChangeType(data, typeof(T));
}
catch
{
return default(T);
}
}
Ya no se que hacer u.u
(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)