Kendo UI error in MVC 5 - kendo-ui

Upgraded my applicaiton from MVC 3 to mVC 5 and kendo UI to Q1 2014. Got this exception
"An exception of type 'System.NullReferenceException' occurred in App_Web_field.master.78ead928.iz8p2r9r.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object."
here is my .cshtml file
#(Html.Kendo().Grid<CustomerModel>()
.Name("grid")
.Columns(columns => {
columns.Bound(p => p.Sender);
columns.Bound(p => p.Body);
})
.Selectable(s => s.Mode(GridSelectionMode.Single))
.Groupable()
.Events(ev => { ev.DataBound("onDataBound").Change("onChange"); })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(20)
.Model(model =>
{
model.Field(c => c.Sender).Editable(false);
model.DateTimeField(c => c.Sent).Editable(false);
})
.Read(read => read.Action("GetCustomers", Html.CurrentControllerName()))
)
)
intellisense says System.Web.WebPages.Html.HtmlHelper doesnot contain a definition for kendo.
here is the stack trace
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.views_inputbuilders_displaytemplates_field_master.__Render__control1(HtmlTex tWriter __w, Control parameterContainer) in
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +53
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386

Have you updated the kendo.mvc.dll reference?
Also do you have the Kendo.Mvc.UI namespace in your pages webconfig? (I generally find this is the issue when #html.kendo() is not found by intellisense)
Since you have added the required reference to all logical places then, give the project a clean and rebuild. (If you have had to include the namespace into the views webconfig just restart visual studio to pick up the change - again I find it doesn't always pick up the change straight away)
Other than seeing the project itself it's difficult to give you a root cause of this.
Also make sure you have updated the references to the kendo.js files in your layout page.
(Paul I know this still doesn't answer the question but I am trying to help a fellow developer here with minimal information being provided)

This line tells me you're missing the namespace in the view web.config:
intellisense says System.Web.WebPages.Html.HtmlHelper doesnot contain
a definition for kendo.
Make sure this line is added in your views/web.config file, under the namespaces element
<add namespace="Kendo.Mvc.UI"/>
Note that if you are using areas, this must be in the web.config of the views folder in each area.

Related

PRISM + Splat as IOC

I have previously used DryIOC as my IOC before, but I would like to try Splat for my IOC, would it be possible to combine these two?
I have tried making a LoginModule whom inherits the IModule so I have this on my LoginModule class:
public void OnInitialized(IContainerProvider containerProvider)
{
Locator.CurrentMutable.RegisterLazySingleton(() => new ServiceEntityMapper(), typeof(IServiceEntityMapper));
Locator.CurrentMutable.RegisterLazySingleton(() => new LoginAPIService(), typeof(ILoginAPIService));
Locator.CurrentMutable.RegisterLazySingleton(() => new LoginManager(
Locator.Current.GetService<IServiceEntityMapper>(),
Locator.Current.GetService<ILoginAPIService>()), typeof(ILoginManager));
}
and I have this for my view model constructor:
public LoginViewModel(INavigationService navigationService, ILoginManager loginManager = null) : base(navigationService)
{
LoginManager = loginManager ?? Locator.Current.GetService<ILoginManager>();
}
In result, I get this exception whenever I navigate to the page
{System.TypeLoadException: Could not resolve the signature of a virtual method
at System.Lazy`1[T].CreateValue () [0x00081] in <fe08c003e91342eb83df1ca48302ddbb>:0
at System.Lazy`1[T].LazyInitValue () [0x00080] in <fe08c003e91342eb83df1ca48302ddbb>:0
at System.Lazy`1[T].get_Value () [0x0003a] in <fe08c003e91342eb83df1ca48302ddbb>:0
at Splat.DependencyResolverMixins+<>c__DisplayClass7_0.<RegisterLazySingleton>b__0 () [0x00000] in <89c762f12a12451a8970372dc9921547>:0
at Splat.ModernDependencyResolver.GetService (System.Type serviceType, System.String contract) [0x00032] in <89c762f12a12451a8970372dc9921547>:0
at Splat.DependencyResolverMixins.GetService[T] (Splat.IDependencyResolver resolver, System.String contract)
From what I've seen Splat is a Service Locator not an actual DI Container. That said you certainly are not limited to the base Prism implementations, as those are provided to make it simple to adopt and get started. What I might suggest in your case is to create your own implementation of IContainerExtension and inherit from PrismApplicationBase.
You can see it's really not that much extra work in your App class by looking either at the implementations for Unity or DryIoc... there is a similar example using the Grace DI Container. Keep in mind that a couple of new API's have been added since the last preview, with a proposed breaking change to make IContainerRegistry have a fluent API.

Link all in Xamarin release,failed with Autofac Assembly

When setting the Linker behaviour to "Link all" I get the following error at runtime:
Autofac.Core.DependencyResolutionException.
I've tried adding ignore assembly Autofac but without success.
Setting the Linker behavior to "Link Framework SDKs only" does work but I want to enable "Link All" if possible.
Thanks in advance.
Update :
ReflectionActivator.ActivateInstance (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
Autofac.Core.DependencyResolutionException: No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = RestService (ReflectionActivator), Services = [Eela.Model.Xamarin.Interfaces.IRestService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'. (See inner exception for details.)
1
ReflectionActivator.ActivateInstance (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
2
InstanceLookup.Activate (System.Collections.Generic.IEnumerable`1[T] parameters)
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = RestService (ReflectionActivator), Services = [Eela.Model.Xamarin.Interfaces.IRestService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'. (See inner exception for details.)
1
InstanceLookup.Activate (System.Collections.Generic.IEnumerable`1[T] parameters)
2
InstanceLookup.Execute ()
3
ResolveOperation.GetOrCreateInstance (Autofac.Core.ISharingLifetimeScope currentOperationScope, Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
4
ResolveOperation.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
5
ResolveOperation.Execute (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
6
LifetimeScope.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
7
Container.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
8
ResolutionExtensions.TryResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters, System.Object& instance)
9
ResolutionExtensions.ResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters)
10
ResolutionExtensions.Resolve (Autofac.IComponentContext context, System.Type serviceType, System.Collections.Generic.IEnumerable`1[T] parameters)
11
ResolutionExtensions.Resolve[TService] (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
12
ResolutionExtensions.Resolve[TService] (Autofac.IComponentContext context)
13
App+<OnStart>d__4.MoveNext ()
14
ExceptionDispatchInfo.Throw ()
15
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state)
16
SyncContext+<>c__DisplayClass2_0.<Post>b__0 ()
17
Thread+RunnableImplementor.Run ()
18
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
19
(wrapper dynamic-method) System.Object:f9684b08-49ee-4f47-8b7c-c59b675c18f3 (intptr,intptr)
So as your Stack Trace indicates. Autofac is trying to instantiate an instance of Eela.Taxi.Service.RestService. However, it seems like the Mono Linker has removed the constructor because it is never directly invoked.
So you could do a couple of things. You could:
Add your assembly to be ignored from the linker
You could add a [Preserve] attribute on your RestService to tell the Linker not to touch it
You could similar to what MvvmCross does have a LinkerPleaseInclude.cs file which describes usage of each type that get stripped out. So for every one you discover you will need to add it here.
So 1. and 2. are fairly self explanatory. You have already used 1. for autofac, just do the same for your own assembly containing RestService. However, the downside here is that nothing in this assembly will be linked, potentially leaving you with a lot more code in it than actually needed.
For 2. you simply add [Preserve] right before declaring your class. So something like:
[Preserve]
public class RestService : IRestService { }
You may also consider using it with AllMembers = true: [Preserve(AllMembers = true)] to keep member fields too.
As for the last option. You basically create a LinkerPleaseInclude.cs in your App project. You let the linker do its job. You continue adding stuff to the class until the Linker does kill your App at runtime. So a start on LinkerPleaseInclude.cs could look like:
[Preserve(AllMembers = true)]
public class LinkerPleaseInclude
{
public void Include(IRestService service)
{
service = new RestService();
}
}
This class is never invoked, but it is enough for the linker to know that the constructor of RestService should not be linked out.

How to read linker error in Xamarin

I get the following error while executing my Xamarin Android app in release mode. I suppose something is missing in LinkerPleaseInclude.cs, but the error message is not very helpful.
09-25 16:17:38.140 W/art ( 1082): JNI RegisterNativeMethods: attempt to register 0 native methods for mvvmcross.binding.droid.views.MvxRadioGroup
[0:] MvxBind:Error: 2,89 Exception thrown during the view binding ArgumentNullException: missing source event info in MvxWeakEventSubscription
Parameter name: sourceEventInfo
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00017] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0
at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription`2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.String sourceEventName, System.EventHandler`1[TEventArgs] targetEventHandler) [0x00012] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0
at MvvmCross.Platform.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe[TSource,TEventArgs] (TSource source, System.String eventName, System.EventHandler`1[TEventArgs] eventHandler) [0x00000] in <54d9eb77c4d448d4bc5e7c7a5cdd0a97>:0
at MvvmCross.Binding.Droid.Target.MvxTextViewTextTargetBinding.SubscribeToEvents () [0x0000b] in <cc9453c0f5794d529a8b1975bb62dd40>:0
at MvvmCross.Binding.Bindings.MvxFullBinding.CreateTargetBinding (System.Object target) [0x00057] in <5d9349f2d9c240e38eaeca40fe71d977>:0
at MvvmCross.Binding.Bindings.MvxFullBinding..ctor (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x0002f] in <5d9349f2d9c240e38eaeca40fe71d977>:0
at MvvmCross.Binding.Binders.MvxFromTextBinder.BindSingle (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00000] in <5d9349f2d9c240e38eaeca40fe71d977>:0
at MvvmCross.Binding.Binders.MvxFromTextBinder+<>c__DisplayClass2_0.<Bind>b__0 (MvvmCross.Binding.Bindings.MvxBindingDescription description) [0x00018] in <5d9349f2d9c240e38eaeca40fe71d977>:0
at System.Linq.Utilities+<>c__DisplayClass2_0`3[TSource,TMiddle,TResult].<CombineSelectors>b__0 (TSource x) [0x00012] in <9ecdeee51aa740839577d6db9550e95f>:0
at System.Linq.Utilities+<>c__DisplayClass2_0`3[TSource,TMiddle,TResult].<CombineSelectors>b__0 (TSource x) [0x00000] in <9ecdeee51aa740839577d6db9550e95f>:0
at (wrapper delegate-invoke) System.Func`2[System.Collections.Generic.KeyValuePair`2[System.String,MvvmCross.Binding.Parse.Binding.MvxSerializableBindingDescription],System.Collections.Generic.KeyValuePair`2[System.Object,MvvmCross.Binding.Bindings.IMvxUpdateableBinding]]:invoke_TResult_T (System.Collections.Generic.KeyValuePair`2<string, MvvmCross.Binding.Parse.Binding.MvxSerializableBindingDescription>)
at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00048] in <9ecdeee51aa740839577d6db9550e95f>:0
at System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) [0x000ea] in <b2855d13f99e445b95990a59348d98e8>:0
at System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) [0x00000] in <b2855d13f99e445b95990a59348d98e8>:0
at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.StoreBindings (Android.Views.View view, System.Collections.Generic.IEnumerable`1[T] newBindings) [0x00028] in <cc9453c0f5794d529a8b1975bb62dd40>:0
at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute (Android.Views.View view, Android.Content.Res.TypedArray typedArray, System.Int32 attributeId) [0x0001c] in <cc9453c0f5794d529a8b1975bb62dd40>:0
I see, something is missing with MvxRadioGroup. How do I find out what to add in LinkerPleaseInclude?
My binding for MvxRadioGroup is the following:
<MvxRadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="6dp"
local:MvxBind="ItemsSource GenderAnswers; SelectedItem GenderAnswer"
local:MvxItemTemplate="#layout/radioitem_enum" />
and my LinkerPleaseInclude is still empty.
Here's the defintiion of the properties in view model:
public IEnumerable<GenderQuestionAnswers> GenderAnswers => Enum.GetValues(typeof(GenderQuestionAnswers)).Cast<GenderQuestionAnswers>();
public GenderQuestionAnswers? GenderAnswer
{
get => _genderAnswer;
set => SetProperty(ref _genderAnswer, value);
}
[edit 2017-09-27]: added code for MvxRadioGroup binding
[edit 2017-09-27]: added snippet for properties in view model
I ended up adding theses lines to LinkerPleaseInclude in addition to the file mentioned by #york-shen-msft
public void Include(RadioButton radioButton)
{
radioButton.CheckedChange += (sender, args) => radioButton.Checked = args.IsChecked
}
Well, that doesn't really answer my question as I wanted to know how to find the correct solution without searching the whole internet for lines others included before and do trial and error, but it solves my actual problem for the moment.

nHibernate second-level cache with memcached and random invalid casts

I have an MVC3 application using nHibernate and memcached as the second level cache provider. We've been intermittently (but much more frequently lately) getting weird casting issues. It happens randomly and invalidating the memcached cache will fix the problem for while.
It only happens in our Production environment because we don't run memcached in our other environments. However I run memcached locally and have tried to get this to occur locally with no luck.
We are using memcached 1.2.6 on Windows. Here's the stack trace. I know it's not going to be enough information to determine anything but if anyone has any ideas about how I could debug this that would be appreciated. I'm trying to get remote debugging on our Production machine but it's a busy time of year and risky.
Unable to cast object of type 'System.Int32' to type 'System.String'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.]
(Object , Object[] , SetterCallback ) +4270
NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer(Object entity, Object[] values) +80
[PropertyAccessException: Invalid Cast (check your mapping for property type mismatches); setter of MyApplication.Business.Data.Program]
NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer(Object entity, Object[] values) +207
NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValues(Object entity, Object[] values) +97
NHibernate.Cache.Entry.CacheEntry.Assemble(Object[] values, Object result, Object id, IEntityPersister persister, IInterceptor interceptor, ISessionImplementor session) +306
NHibernate.Cache.Entry.CacheEntry.Assemble(Object instance, Object id, IEntityPersister persister, IInterceptor interceptor, ISessionImplementor session) +147
NHibernate.Event.Default.DefaultLoadEventListener.AssembleCacheEntry(CacheEntry entry, Object id, IEntityPersister persister, LoadEvent event) +434
NHibernate.Event.Default.DefaultLoadEventListener.LoadFromSecondLevelCache(LoadEvent event, IEntityPersister persister, LoadType options) +800
NHibernate.Event.Default.DefaultLoadEventListener.DoLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) +560
NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) +229
NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) +438
NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) +943
NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) +99
NHibernate.Impl.SessionImpl.Get(String entityName, Object id) +117
NHibernate.Impl.SessionImpl.Get(Object id) +70
MyApplication.Business.Repositories.Repository`1.Get(Object id) +148
We've been encountering the same issue and we have pinpointed the problem to invalid cache entries in the second level cache. In our case the problem arises when we add or remove columns/properties from tables/entities that are cached in the second level cache and deploy the change. The code expects five columns (for argument's sake) whereas the cache stores six columns.
One strategy that we employed in our repository is to catch the exception and invalidate the cache. We then retry the get.
public override T Get(int id)
{
try
{
return base.Get(id);
}
catch (InvalidCastException)
{
_sessionFactory.EvictEntity(typeof (T).Name);
return Get(id);
}
}
Hope this helps!
Most probably this is caused by different dataset returned by the queries on the production environment and your local. The object mapper is getting different data than what its expecting. When trying to convert the data then you are getting these exceptions.

Index out of range error in Telerik reporting

I am getting Server Error in '/' Application.
Exception Details:
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name:
index
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +67
System.ThrowHelper.ThrowArgumentOutOfRangeException() +16
System.Collections.Generic.List`1.get_Item(Int32 index) +19
Telerik.Reporting.HtmlRendering.HtmlElementRenderer.GetEndElement(ProcessingElement startElement) +267
Telerik.Reporting.HtmlRendering.HtmlElementRenderer.BeginRender(HtmlRenderingContext context) +382
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +17
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.ContainerElementRenderer.Render(HtmlRenderingContext context) +108
Telerik.Reporting.HtmlRendering.BaseElementRenderer.RenderToHtml(HtmlRenderingContext context) +26
Telerik.Reporting.HtmlRendering.HtmlTextBoxRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context) +163
Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context) +92
Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +50
Telerik.Reporting.HtmlRendering.Matrix.RenderInternal(HtmlRenderingContext context) +3645
Telerik.Reporting.HtmlRendering.Matrix.Render(HtmlRenderingContext context) +40
Telerik.Reporting.HtmlRendering.ReportSectionBaseRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context) +69
Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context) +92
Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item) +50
Telerik.Reporting.HtmlRendering.HtmlPage.RenderReportSections(HtmlWriter bodyWriter) +557
Telerik.Reporting.HtmlRendering.HtmlPage.RenderBody(HtmlWriter bodyWriter) +320
Telerik.Reporting.HtmlRendering.HtmlPage.Render(HtmlTextWriter primaryWriter, HtmlRenderingContext renderingContext) +112
Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer, Int32 startPage, Int32 endPage) +304
Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer) +56
Telerik.Reporting.HtmlRendering.HtmlRenderingExtension.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +134
Telerik.Reporting.Processing.ReportProcessor.Render(IList`1 reports, ExtensionInfo extensionInfo, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback) +352
Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName) +421
Telerik.ReportViewer.WebForms.ServerReport.Render(HttpResponse response, String format, Int32 pageIndex) in c:\Projects\Reporting\FromSC_scrum\#ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\ServerReport.cs:90
Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperation(NameValueCollection urlQuery, HttpContext context) in c:\Projects\Reporting\FromSC_scrum\#ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\ReportPageOperation.cs:25
Telerik.ReportViewer.WebForms.HttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) in c:\Projects\Reporting\FromSC_scrum\#ReportingBuild\Reporting_Build\Net20\Telerik.ReportViewer.WebForms\HttpHandler.cs:59
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +705
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
I am getting this error in Telerik Report viewer.
Getting this error only for specific criteria not for all the values.
where i am missing something?
Please help me.
I have same problem. I didn't figured out its origin yet, but I suppose it comes from data source binding. When you create new instance on report it creates default controls in InitializeComponent() method (for example, List with 0 rows or TextBox without text). And when you bind data source (for example, List with 3 items) it refer to List (Telerik Reporting control) and try to bind collection with 3 items to control with 0 rows. So in this case you had OutOfRangeException. Something like that, I guess.
UPD: actually, I had resolved my problem yesterday. It was all because I try to bind empty collection as control's data source. I just added default object (with empty properties) to my collection if it contains no elements before binding.
We have been experiencing a very similar issue intermittently. Clearing out the Telerik state database tables seems to resolve it sometimes for us. You can flip #Condition to 1 in the script below to execute the delete.
DECLARE #Condition AS BIT = 0;
IF #Condition = 1
BEGIN
DELETE dbo.tr_AppLock;
DELETE dbo.tr_Object;
DELETE dbo.tr_Set;
DELETE dbo.tr_String;
END;
SELECT *
FROM dbo.tr_AppLock AS tal;
SELECT *
FROM dbo.tr_Object AS tob;
SELECT *
FROM dbo.tr_Set AS ts;
SELECT *
FROM dbo.tr_String AS ts;
Check that you can preview the report in the Telerik Report Designer.
I was seeing the same error when running code:
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name:
index
In the report designer I had the error:
Missing or invalid parameter value. Please input valid data for all
parameters
I corrected the Report Designer error (by adding a default parameter value, see screenshot below) and made no other 'code' changes, this resolved both issues.
Interestingly if I remove the default value the Report Designer error returns but running the report in code remains OK (possibly the report is cached somewhere in a valid state?)

Resources