FoxPro/Visual FoxPro - Problemas al ejecutar tareas tipo Async y Await

<<>>
 
Vista:
Imágen de perfil de Otniel

Problemas al ejecutar tareas tipo Async y Await

Publicado por Otniel (1 intervención) el 24/03/2025 21:20:26
Buenas
Tengo un Dll hecho en c# con el siguiente código
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public string ConSem(string cUrl, string RootSem)
{
    try
    {
        // Instanciar HttpClient
        using (HttpClient client = new HttpClient())
        {
            MessageBox.Show("Antes de subir a web");
            HttpResponseMessage response = client.GetAsync(cUrl).Result;
            MessageBox.Show("Después de subir a web");
            response.EnsureSuccessStatusCode();
            string xmlContent = response.Content.ReadAsStringAsync().Result;
            File.WriteAllText(RootSem, xmlContent);
            MessageBox.Show(xmlContent);
            return xmlContent;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show("Ocurrió un error: " + ex.Message);
        return "Error";
    }
}

Y necesito usarlo en VFP9
Al llegar al HttpResponseMessage response = client.GetAsync(cUrl).Result no sigue ejecutando el código y me da error, lo mismo ocurre si trato de hacer que la función completa sea asíncrona o tenga la propiedad Await

Por si el caso, este es el código que uso para consultar el dll en VFP

1
2
3
4
5
6
7
8
9
cRutaXML = "https://ecf.dgii.gov.do/testecf/autenticacion/api/Autenticacion/Semilla"
CC= SPACE(0)
Dilepa = "D:\ProjectVFP\Teo.xml"
LOCAL cResultado As String
  cResultado = ''
  oFirmaXml  = CREATEOBJECT('dllEnvio')
  cResultado = oFirmaXml.ConSem(cRutaXML,Dilepa)
? cResultado
RELEASE ALL
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder