This is a migrated thread and some comments may be shown as answers.

Unable to resolve service for type 'Kendo.Mvc.Rendering.IKendoHtmlGenerator'

1 Answer 754 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Congero
Top achievements
Rank 1
Congero asked on 27 Oct 2020, 08:15 PM
I am running a project  using asp.net core 3.1 and my view which contains the Kendo Grid is throwing this error



InvalidOperationException: Unable to resolve service for type 'Kendo.Mvc.Rendering.IKendoHtmlGenerator' while attempting to activate 'Kendo.Mvc.TagHelpers.GridTagHelper'.
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired)
lambda_method(Closure , IServiceProvider , object[] )
Microsoft.AspNetCore.Mvc.Infrastructure.TypeActivatorCache.CreateInstance<TInstance>(IServiceProvider serviceProvider, Type implementationType)
Microsoft.AspNetCore.Mvc.Razor.Infrastructure.DefaultTagHelperActivator.Create<TTagHelper>(ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.DefaultTagHelperFactory.CreateTagHelper<TTagHelper>(ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.RazorPageBase.CreateTagHelper<TTagHelper>()
AspNetCore.Views_Product_Index.ExecuteAsync() in Index.cshtml
+
ViewData["Title"] = "Home Page";
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)



My project references this Kendo package

  <PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2020.2.812-Internal" />



These lines are in my _ViewImports.cshtml

@using Kendo.Mvc.UI

@addTagHelper *, Kendo.Mvc

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

In my Index.cshtml I have this code
@{
    ViewData["Title"] = "Home Page";
}



<div class="row">
    <div class="col-12">
        <kendo-grid name="grid" height="550">
            <columns>
                <column field="Id" title="Id">
                    <filterable enabled="false"></filterable>
                </column>
                <column field="BinNum" title="BinNum" />
                <column field="RunDate" title="RunDate" format="{0:MM/dd/yyyy}" />
                <column field="Type" title="Type" />
                <column field="Fee" title="Fee" />
            </columns>
            <scrollable enabled="true" />
            <sortable enabled="true" />
            <pageable enabled="true" />
            <filterable enabled="true" />
            <datasource type="DataSourceTagHelperType.Ajax" page-size="20">
                <transport>
                    <read url="@Url.Action("Read_Product", "ProductGrid")" />
                </transport>
            </datasource>
        </kendo-grid>
    </div>
</div>

1 Answer, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 30 Oct 2020, 11:29 AM

Hi Congero,

What I can see from the shared code, you are using an internal build version of the Telerik.UI.for.AspNet.Core package. Can you change the version to an official one and try building your project with this official version. I would suggest trying running your project with our latest product version - 2020.3.1021.

If changing the version to an official one doesn't resolve the issue in your application, to be able to help you further with this case, I will need a runnable example in which the issue can be replicated. If you don't manage to fix the issue, send me the mentioned runnbale project and I will further investigate what is triggering the error.  

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Congero
Top achievements
Rank 1
Answers by
Petar
Telerik team
Share this question
or