es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: ASYNC-AWAIT

El proceso System.Diagnostics.Process sigue ejecutándose cuando el hilo principal se apaga incorrectamente en C#.

Ejemplo ilustrando mi proyecto. static async Task Main() { await RunAsync(“a.exe”, string.Empty, string.Empty, 100000, null); } static async Task RunAsync(string fileName, string arguments, string workingDir, int timeLimit, string input) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = fileName.ToString(); startInfo.Arguments = arguments.ToString(); startInfo.WorkingDirectory = workingDir; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; . . . Read more

Raspatar básico no sale de la función async.

Cuando ejecuto esta función, obtengo el resultado esperado a través de console.log, pero la función no se cierra. ¿Por qué es así? const puppeteer = require(‘puppeteer’); async function scrape(url) { const browser = await puppeteer.launch(); const page = await browser.newPage(); const target = await page.goto(url); const waiting = await page.waitForXPath(‘XPATH…’); . . . Read more

El futuro está atascado en la declaración de retorno y nunca completa la función futuro llamada desde allí.

getInitialTripData llama a getCurrentLocationData con await pero nunca imprime “coming here 1” y en getCurrentLocationData la función continúa hasta imprimir los datos y luego se bloquea en la declaración de retorno, no sé cuál es el problema. “` setInitialTripData() async { print("coming here"); MapLocation startingPoint = await Get.find<locationservice>().getCurrentLocationData(); print("coming here . . . Read more

Comprendiendo Async y Await en .Net

De los ejemplos a continuación, no entiendo por qué el código async y await no funcionan en el primer ejemplo pero sí funcionan en el segundo ejemplo. 1er Ejemplo: public static async Task Main(string[] args) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Console.WriteLine(“comenzó”); var i = await GetIntAsync(10); var j . . . Read more