Warning CS4014 Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

8 views
Skip to first unread message

Carlos Admirador

unread,
Dec 3, 2022, 2:10:34 AM12/3/22
to AltNet-Hispano

En VS2022, net5 aparece este warning:


Warning    CS4014    Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. 


Código:

internal async Task<bool> SincronizarUsuario(UsersServiceClient apiCliente, string DA_usuario, ...

 // TODO: await ....en foreach ??
                //DA_Carpeta.ForEach(async g => {
                DA_Carpeta.ForEach(carpeta =>
                {
                    Console.WriteLine(carpeta);
                    AñadirUsuarioServicio(apiCliente, DA_usuario, carpeta, capitalizedDA_Grupo);
                });

                await AñadirUsuarioAPortalMentor(DA_usuario, CODLABOR);

soluciones?

Paco

unread,
Dec 3, 2022, 6:22:03 PM12/3/22
to altnet-...@googlegroups.com
Te sugiero que hagas lo posible por leer este libro
Concurrency in C# Cookbook: Asynchronous, Parallel, and Multithreaded Programming

--
Has recibido este mensaje porque estás suscrito al grupo "AltNet-Hispano" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a altnet-hispan...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/altnet-hispano/ee1dab40-d5ee-4a29-bd3b-c1ec089da559n%40googlegroups.com.

Kiquenet

unread,
Dec 8, 2022, 6:25:53 AM12/8/22
to AltNet-Hispano
Stephen Cleary es un gurú del asíncronismo.

There is no best practice, and here's why:

Every hack works in some situations and does not work in other situations. There is no hack that works in all situations. If there was a hack that worked everywhere, then that would be what everyone would use and that hack would be the best practice. But there isn't a hack that works everywhere, so there is no "best practice". There is no general-purpose solution.



Reply all
Reply to author
Forward
0 new messages