zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Sequence contains no matching element #51

Closed tusharbsale closed 4 years ago

tusharbsale commented 4 years ago

I am getting error as 'Sequence contains no matching element'

I am working on .net core 2.2 application and i had set DefaultBreadcrumb in my HomeController and Breadcrumb attribute in remaining Controllers action methods but on startup.cs in services.AddBreadcrumbs(GetType().Assembly) line getting error as Sequence contains no matching element.

Can anyone facing similar issue ?can anyone guide regarding same.

zHaytam commented 4 years ago

Hello, is it possible for you to send me a project where I can reproduce the issue? Since you say you have a DefaultBreadcrumb set up, it's hard for me to know where the problem is :/

tusharbsale commented 4 years ago

Hello, is it possible for you to send me a project where I can reproduce the issue? Since you say you have a DefaultBreadcrumb set up, it's hard for me to know where the problem is :/

Hi, just identified that if action method is defined as async Task<ActionResult> then it is not getting picked up in list of breadcrumbs. for ex. my action method used in project is 'public async Task<ActionResult> Index()'

Can you pls check

zHaytam commented 4 years ago

Ah yes, SmartBreadcrumbs only looks for IActionResult right now... Is there a reason why you're using the implementation instead of the interface? Using the interface is always preferred.

tusharbsale commented 4 years ago

Thanks. I am changing my method to IActionResult now and it is working now. Cool Stuff :-)

bstoddart commented 3 years ago

Hello,

I am using the 3.6.1 version of SmartBreadcrumbs and I have the same problem. I have confirmed that I am using IActionResult. Is there something else I should inspect.

bstoddart commented 3 years ago

Sorry, I figured it out! I need to have a least 1 breadcrumb :)