Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.InvalidOperationException: 'Sequence contains no matching element' #101

Open
jylaila opened this issue Mar 17, 2022 · 4 comments
Open

Comments

@jylaila
Copy link

jylaila commented Mar 17, 2022

This is my class in razor

[Breadcrumb("createdrequests")]
public partial class CreatedRequests
{
}

and I´m having this issue:
System.InvalidOperationException: 'Sequence contains no matching element'

@madeyellow
Copy link

madeyellow commented Apr 18, 2022

For all those who have same issue - try to add DefaultBreadcrumb attribute on your homepage action, e.g.:

[Route("/")]
public class HomeController : Controller
{
        [DefaultBreadcrumb]
        public IActionResult Index()
        {
            return View();
        }
}

This should solve your problem with 'Sequence contains no matching element' error.

@oflahero
Copy link

Thanks, madeyellow - now I have System.InvalidOperationException: 'Sequence contain more than one matching element' :D

@madeyellow
Copy link

Thanks, madeyellow - now I have System.InvalidOperationException: 'Sequence contain more than one matching element' :D

Most likely it's because you have more than one [DefaultBreadcrumb] attribute in project. Check all your controllers and ensure that you have only one DefaultBreadCrumb attribute, which is by the way should be action, that renders main (home) page. For all other actions you should use [Breadcrumb] attribute instead (as in your original post from 17 March).

@oflahero
Copy link

Thanks (I'm not the OP though!) Fixed my issue anyway - was mixing Razor pages with controllers'n'views in my project, so cleared up that extra cruft and it's OK now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants