Closed Renato-Garbim closed 4 years ago
Can you show me your action that it fails to get?
This
[Breadcrumb("My Action")]
public async Task<ActionResult> Index()
{
var model = new TokenModelList
{
PaginacaoEOrdenacao = (ModelPaginacaoEOrdenacao)TempData["PaginacaoEOrdenacao"],
Pesquisa = (TokenPesquisaDTO)TempData["Pesquisa"]
};
TempData["PaginacaoEOrdenacao"] = null;
TempData["Pesquisa"] = null;
model = await CarregarViewDataAsync(model);
return View(model);
}
The library handles async actions. I'm not sure where the problem is.
Did you try and breakpoint that line and see what nodeKey
is?
Sorry , how could i debug to see the nodeKey ? What i found out till now is, when i got an Action that is async Task< IActionResult > it works, but if i replace the IActionResult for ActionResult i did not work.
[Breadcrumb("Produto")]
public async Task<ActionResult> Index()
{
return View();
}
returns this:
that doesnt work as it should. And my Action like this
[Breadcrumb("Produto")]
public async Task<IActionResult> Index()
{
return View();
}
returns
this one works, he get the nodeKey if this is what you mean..
At ReflectionExtensions class i add a custom line to identify this sort of situation as well
#region Fields
private static readonly Type PageModelType = typeof(PageModel);
private static readonly Type ControllerType = typeof(Controller);
private static readonly Type ActionResultType = typeof(IActionResult);
private static readonly Type ActionResultTaskType = typeof(Task<IActionResult>);
//Custom Code
private static readonly Type ActionResultClassType = typeof(Task<ActionResult>);
and it seems to be working just fine, but i dont get very well all the code to point out what kind of troube this can cause at the future.
Do you got noted at somewhere why did you make only for the interface of ActionResult ? with some quick search I found this https://forums.asp.net/t/2071936.aspx?What+is+difference+between+Actionresult+and+IActionresult where i get that IActionResult has a broader coverage of cases, but in another ones i prefer to use something more strongly typed like ActionResult. This makes some sense ?
Imho, there is no real difference between returning IActionResult
or ActionResult
. Although I prefer the interface. If ActionResult
inherits from IActionResult
then I can make sure SmartBreadcrumbs works with every return type that inherits it. For now, you can work with your work-around until I update the library :')
` public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var child = await output.GetChildContentAsync();
At line 47 in the var node, when the action is an async he will always return a null, still tryng to find why, but probably some await missing.