"la secuencia no contiene elementos"

Luis Leonardo Liceaga Franco 0 Reputation points
2026-11-18T01:43:20.1033333+00:00

que hacer cuando te sale una advertencia de "la secuencia no contiene elementos" en visual estudio de escritorio

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

2 answers

Sort by: Newest
  1. Mariem Moalla 81 Reputation points MVP
    2026-11-18T11:04:21.24+00:00

    This error usually comes from your code trying to get an element from an empty collection using methods like First() or Single() without checking if the sequence has items. Check your LINQ queries and replace such calls with FirstOrDefault(), SingleOrDefault().

    Was this answer helpful?

    0 comments No comments

  2. Brian Pham (WICLOUD CORPORATION) 1,515 Reputation points Microsoft External Staff Moderator
    2026-11-18T02:51:34.43+00:00

    Hola @Luis Leonardo Liceaga Franco ,

    Gracias por tu consulta.

    Para investigar el error "La secuencia no contiene elementos", ¿podrías indicarme qué versión de Visual Studio utilizas, cuándo aparece el error y, si es posible, compartir una captura de pantalla?

    Como paso inicial, si el problema ocurre dentro de Visual Studio, puedes intentar iniciarlo en modo seguro mediante el comando devenv /SafeMode. Esto me ayudará a comprobar si alguna extensión podría estar relacionada con el problema.

    Si el error ocurre al ejecutar tu aplicación, por favor comparte el mensaje completo de la excepción o la traza de pila.

    Quedo atento a tu respuesta.

    Si mi respuesta te ha resultado útil o informativa, te agradecería mucho que siguieras esta guía para confirmar la respuesta.

    ¡Muchas gracias!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.