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

ViewComponent could not be found in Welcome_Page template test #1811

Closed
Xeevis opened this issue Sep 27, 2019 · 1 comment
Closed

ViewComponent could not be found in Welcome_Page template test #1811

Xeevis opened this issue Sep 27, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@Xeevis
Copy link
Contributor

Xeevis commented Sep 27, 2019

Reproduction steps:

PS> dotnet tool install -g --version 0.21.0 Volo.Abp.Cli
PS> abp new Acme.BookStore
PS> dotnet test

[xUnit.net 00:00:10.01] Acme.BookStore.Pages.Index_Tests.Welcome_Page [FAIL]
X Acme.BookStore.Pages.Index_Tests.Welcome_Page [8s 859ms]
Error Message:
System.InvalidOperationException : A view component named 'Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook.LayoutHookViewComponent' could not be found. A view component must be a public non-abstract class, not contain any generic parameters, and either be decorated with 'ViewComponentAttribute' or have a class name ending with the 'ViewComponent' suffix. A view component must not be decorated with 'NonViewComponentAttribute'.
Stack Trace:
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.SelectComponent(Type componentType)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeAsync(Type componentType, Object arguments)
at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpViewComponentHelper.InvokeAsync(Type componentType, Object arguments)
at AspNetCore._Themes_Basic_Layouts_Application.<>c__DisplayClass14_0.<b__0>d.MoveNext() in /Themes/Basic/Layouts/Application.cshtml:line 36

@maliming maliming self-assigned this Sep 30, 2019
@maliming
Copy link
Member

maliming commented Sep 30, 2019

This seems to be related to this.

//This is needed after ASP.NET Core 3.0 upgrade.
context.Services.AddMvc()
.PartManager.ApplicationParts
.Add(new AssemblyPart(typeof(AbpAspNetCoreMvcModule).Assembly));

Missing ApplicationParts in unit tests.

Volo.Abp.AspNetCore.Mvc.UI
Volo.Abp.AspNetCore.Mvc.UI.Widgets
Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic

@hikalkan What do you think?

@ismcagdas ismcagdas added this to the 0.22 milestone Sep 30, 2019
@hikalkan hikalkan self-assigned this Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants