Sequence no matching element

Jun 12, 2012 at 8:00 AM
Edited Jun 12, 2012 at 8:13 AM


I am working with the NO.MVC. Got an error recently, could not solve it anyhow.

This is the error when I run the applicaiton 


"Sequence contains no matching element "

Any tips ??



Jun 12, 2012 at 8:54 AM

You need to provide a lot more information if you want help (e.g. the full error message including a stack trace, and what you were doing when you got the error).  That error message is a simple .NET error message arising from the use of LINQ  - but that could arise in hundreds of situations.  

If the error is being thrown in your own (domain) code then its caused by writing the wrong Linq query.

Another common possibility is that it is being thrown in Entity Framework code (in which case the stack trace would clearly show that).  Here the most common issue -  if you are working Model First or Database First then the most likely explanation is that the properties in one or more domain classes don't match the properties defined on the corresponding entity type.

But please  -  if you want others to help you - make more effort to provide helpful information.