We are upgraded from MVC 5 to MVC-Core and using now your core components (latest version).
In our AutoComplete box, we get now a NullReference exception, without changing anything at our codebase.
Generated Script from Kendo MVC-Core:
kendo.syncReady(function(){jQuery("#txtSearchForLink").kendoAutoComplete({"select":insertLink.searchResultSelected,"dataTextField":"Text","filter":"Contains","footerTemplate":jQuery('#searchResultFooterTemplate').html(),"minLength":0,"placeholder":"Suchen","template":jQuery('#searchResultTemplate').html(),"dataSource":{"type":"aspnetmvc-ajax","transport":{"read":{"url":"/Orphy/Search/GetQuickSearchData","data":insertLink.onAdditionalData}},"serverFiltering":true,"serverGrouping":true,"sort":[{"field":"Weight","dir":"desc"}],"group":[{"field":"GroupName","dir":"desc"}],"filter":[],"schema":{"data":"Data","model":{"id":"Id"}}}});});
Debugging:
-> context.Count == 0 -> so Null will returned
-> Here you access the property Memeber of Null ... ?
Call Stack:
System.NullReferenceException: Object reference not set to an instance of an object.
at Kendo.Mvc.Infrastructure.Implementation.FilterNodeVisitor.Visit(PropertyNode propertyNode)
at Kendo.Mvc.Infrastructure.Implementation.PropertyNode.Accept(IFilterNodeVisitor visitor)
at Kendo.Mvc.Infrastructure.FilterDescriptorFactory.Create(String input)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.<>c__DisplayClass2_0.<CreateDataSourceRequest>b__3(String filter)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.TryGetValue[T](ModelMetadata modelMetadata, IValueProvider valueProvider, String modelName, String key, Action`1 action)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.CreateDataSourceRequest(ModelMetadata modelMetadata, IValueProvider valueProvider, String modelName)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModelAsync(ModelBindingContext bindingContext)
at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder.<BindModelAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.<BindModelAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() System.NullReferenceException: Object reference not set to an instance of an object.
at Kendo.Mvc.Infrastructure.Implementation.FilterNodeVisitor.Visit(PropertyNode propertyNode)
at Kendo.Mvc.Infrastructure.Implementation.PropertyNode.Accept(IFilterNodeVisitor visitor)
at Kendo.Mvc.Infrastructure.FilterDescriptorFactory.Create(String input)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.<>c__DisplayClass2_0.<CreateDataSourceRequest>b__3(String filter)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.TryGetValue[T](ModelMetadata modelMetadata, IValueProvider valueProvider, String modelName, String key, Action`1 action)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.CreateDataSourceRequest(ModelMetadata modelMetadata, IValueProvider valueProvider, String modelName)
at Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModelAsync(ModelBindingContext bindingContext)
at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder.<BindModelAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.<BindModelAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
Thanks for helping me.
Cyril
The tag helper's dataSource sets the following values: "page"=1 and "pageSize"=20, even though "server-operation" and "server-paging" are disabled in its configuration.
MultiSelect configuration:
<kendo-multiselect name="multiselect1" style="width:100%"
placeholder="Enter name..."
datatextfield="ShipName"
datavaluefield="OrderID"
min-length="2"
enforce-min-length="true">
<datasource type="DataSourceTagHelperType.Ajax" server-operation="false"
server-paging="false"
server-filtering="false"
server-aggregates="false"
server-grouping="false"
server-sorting="false">
<transport>
<read url="@Url.Action("GetData","Home")" />
</transport>
</datasource>
<popup-animation>
<open duration="500" />
<close duration="500" />
</popup-animation>
</kendo-multiselect>
Action:
public ActionResult GetData([DataSourceRequest] DataSourceRequest request)
{
var result = Enumerable.Range(0, 50).Select(i => new OrderViewModel
{
OrderID = i,
Freight = i * 10,
OrderDate = new DateTime(2016, 9, 15).AddDays(i % 7),
ShipName = "ShipName " + i,
ShipCity = "ShipCity " + i
});
var dsResult = result.ToDataSourceResult(request);
return Json(dsResult);
}
The "page" and "pageSize" values are set, which results in only 20 items being displayed, even though more are returned by the "read" action.
The "page" and "pageSize" should not be set, and the MultiSelect should display all the data returned by the "read" action.