Index out of range error in Telerik reporting - telerik

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?)

Related

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.

Cannot delete Custom Entities and it's not about relations

I created a fresh new entity which has no additional fields or relations to anything and also without any records.
Just after i created the entity and when i try to delete it, it gives me the following error:
An error has occurred.
And in the log file which can be downloaded from the error dialog:
System.ArgumentNullException: Value cannot be null. Parameter name: collection
And when enabled tracing the error was:
Process: w3wp |Organization:0220cef0-4f09-e711-80d8-000c2950db72 |Thread: 244 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 17d8623e-7539-48af-9652-b8550acfb76f | EntityService.Delete ilOffset = 0x1A8
>EntityService.Update caught exception: System.ArgumentNullException: Value cannot be null.
Parameter name: collection
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Microsoft.Crm.BusinessEntities.CascadeEngine.LogRecordSetCount(Int32 count, IEnumerable`1 entityIds, Int32 parentEntityObjectTypeCode, String perfCounterName)
at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.CascadeEngine.DeleteAll(Int32 entityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.Metadata.EntityService.Delete(Guid entityId, MetadataHelper metadataHelper, Boolean suppressSecurityCacheFlush, ExecutionContext context)
Well i don't know whats wrong. Please let me know if you know anything. Thanks.
One thing to check is if there are any dependencies, which you can do by selecting the entity in a solution and clicking Show Dependencies:
I did noticed something that this error only happens when Persian language pack is installed, but when its just CRM with no language packs everything is fine.
So at least i know what to do now and it's not something useful to be discussed further here.
Thanks.

How to find issue while installing Managed Package in Cloud CRM Dynamics 365?

I am facing an issue while installing my Managed package in Cloud CRM Dynamics 365. As I am not able to track the issue, it's a headache.
Let me explain the key points:
I have set customizable false for all the components
I have registered Plug-in in Sandbox mode. I have used plugin registration tool for license and a few other functions.
I have tried two ways.
First: When I tried to install the first time, I got unprocess status from workflow.
Second: To solve above issue, I have tried by removing Licence process related component. Now I am getting unprocess status from Plugin Assembly of Updating Sales Order.
The worst thing is I am not getting any error message or error code in log file.
Finally, here are a few logs. Can anybody suggest a solution?
--------------------------------------------------------------------------------------------------------
AsynchronousProcessingService Failed to add the item to the sync item collection for the mailbox : {8CBF53D0-896B-E611-80F2-FC15B4288714}. Exception details : Unhandled Exception: Microsoft.Crm.CrmArgumentException: Invalid input.
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeItemFinder.AddItemToSyncItemChangeInfoCollection(Item item, String itemId, SyncItemChangeType itemChangeType, ItemObjectType itemObjectType, String crmId)
Inner Exception: System.ArgumentException: Invalid input.
AsynchronousProcessingService Failed to add the item to the ItemFinder sync error collection for the mailbox : {8CBF53D0-896B-E611-80F2-FC15B4288714}. Exception details : Unhandled Exception: Microsoft.Crm.CrmArgumentException: Invalid input.
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeItemFinder.AddItemToItemFinderSyncErrors(String itemId, SyncItemChangeType itemChangeType, ItemObjectType itemObjectType, Exception ex)
Inner Exception: System.ArgumentException: Invalid input.
--------------------------------------------------------------------------------------------------------
WebApplicationServer MessageProcessor fail to process message 'InitializeFrom' for 'none'.
--------------------------------------------------------------------------------------------------------
WebApplicationServer InitializeFrom cannot be invoked from source entity of type account with id 89abd2b1-248f-e611-80f3-fc15b4282658 to target entity type task because there is no entity map defined between these two entities.
--------------------------------------------------------------------------------------------------------
WebApplicationServer Web Service Plug-in failed in SdkMessageProcessingStepId: 27cbbb1b-ea3e-db11-86a7-000a3a5473e8; EntityName: none; Stage: 30; MessageName: InitializeFrom; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
Inner Exception: Microsoft.Crm.CrmException: There is no entity map defined for the given entities
at Microsoft.Crm.ObjectModel.CustomizationService.InitializeFrom(BusinessEntityMoniker moniker, String targetEntityName, TargetFieldType targetFieldType, Boolean mapReadSecuredOnSourceAndTarget, ExecutionContext context)
at Microsoft.Crm.ObjectModel.CustomizationService.InitializeFrom(BusinessEntityMoniker moniker, String targetEntityName, TargetFieldType targetFieldType, ExecutionContext context)
--------------------------------------------------------------------------------------------------------
WebApplicationServer MessageProcessor fail to process message 'InitializeFrom' for 'none'.
--------------------------------------------------------------------------------------------------------
WebApplicationServer MSCRM Error Report:
Error: There is no entity map defined for the given entities
Error Number: 0x80040E01
Error Message: There is no entity map defined for the given entities
Error Details: There is no entity map defined for the given entities
Source File: Not available
Line Number: Not available
Request URL:
Stack Trace Info: [CrmException: There is no entity map defined for the given entities]
at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.InitializeFromCommand.Execute()
*Update
Try turning off the plugins and workflows related to the entities and try again. Looks like you code have a bug in your plugin as well.
Based on the error message's it appears TFS does not permission to save the configuration file in the user roaming path:
Error Message: SaveConfigToFile() - fail - \\tpapsvmgmt01\UserMyDocs\sbrown\AppData\Roaming\Microsoft\PackageDeployer\Default_PackageDeployer.exe
Also, what version of the SDK are you using? It states you are using a pre 8.0 version. Ensure you have the latest SDK dll's.
PackageDeployment Information 8 4/4/2017 10:06:45 AM Executing Solution Import Pre v8.0
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose 16 4/4/2017 10:08:43 AM Failed to Execute Command - ImportSolution
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error 2 4/4/2017 10:08:43 AM Source : mscorlib
Method : HandleReturnMessage
Date : 4/4/2017
Time : 10:08:43 AM
Error : Message: Import failed
ErrorCode: -2147188706
Trace:
Stack Trace : Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.Servic
Could be the configuration setting that are being used to
Authentic because it is throwing error invoking channel proxy command.

Telerik RadGrid.MasterTableView.ExportToExcel() Error: The query results enumerated more than once

I have a RadGrid which is populated with some data. I have a button which will Export to Excel via a serverside callback. The server side code is below. And the error below that. Any suggestions?
RadGrid1.Rebind();
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.MasterTableView.ExportToExcel();
The error is:
The query results cannot be enumerated more than once.
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.InvalidOperationException: The query results cannot be enumerated more than once.
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:
[InvalidOperationException: The query results cannot be enumerated more than once.]
System.Data.Linq.SqlClient.OneTimeEnumerable1.GetEnumerator() +884205
System.Data.Linq.SqlClient.SingleResult1.GetEnumerator() +76
System.Linq.Buffer1..ctor(IEnumerable1 source) +302
System.Linq.d__0.MoveNext() +164
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +163
Telerik.Web.UI.GridResolveEnumerable.GetCollectionItemType(Boolean noItemsInEnumerator, Type& collectionItemType, Object& collectionFirstObject) +330
Telerik.Web.UI.GridResolveEnumerable.ParseProperties() +120
Telerik.Web.UI.GridResolveEnumerable.Initialize() +16
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +28
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +242
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +223
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +595
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +243
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +42
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
Telerik.Web.UI.GridTableView.PerformSelect() +9
Telerik.Web.UI.GridTableView.DataBind() +363
Telerik.Web.UI.RadGrid.DataBind() +73
Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2488
Telerik.Web.UI.RadGrid.RebindForExport() +119
Telerik.Web.UI.Grid.Export.TableViewExporter.PrepareForExport() +315
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnPreRender(EventArgs e) +11056782
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
You don't want to call Rebind() before the export. Is there a reason for that? Are you changing/manipulating the data right before the export?
If not, there is no need to call Rebind(), since that is really only meant to refresh the data source.

Why is HttpNotificationChannel.Open throwing ArgumentException() E_INVALIDARG?

Here is my code. Everything works fine the first time I run it, i.e. HttpNotificationChannel.Find() returns null.
But the second time I run it, Find() returns the proper thing, however when I get to the Open() call, it throws an exception. Which is really odd, since Open() doesn't take any arguments.
What am I doing wrong?
public string ChannelName = "MyAppChannel";
...
NotificationChannel = HttpNotificationChannel.Find(ChannelName);
if (NotificationChannel == null)
{
NotificationChannel = new HttpNotificationChannel(ChannelName);
}
NotificationChannel.ChannelUriUpdated += new EventHandler(Channel_ChannelUriUpdated);
NotificationChannel.HttpNotificationReceived += new EventHandler(NotificationChannel_HttpNotificationReceived);
NotificationChannel.ErrorOccurred += new EventHandler(Channel_ErrorOccurred);
NotificationChannel.Open(); // <-- Kaboom here, the 2nd time
Here's the full text and stack:
System.ArgumentException: E_INVALIDARG
at Microsoft.Phone.Notification.SafeNativeMethods.ThrowExceptionFromHResult(Int32 hr, Exception defaultException, NotificationType type)
at Microsoft.Phone.Notification.HttpNotificationChannel.Open()
at LiveShare.NotificationManager.Initialize()
at LiveShare.App..ctor()
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at MS.Internal.TypeProxy.<>c__DisplayClass30.b__2a()
at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
at MS.Internal.FrameworkCallbacks.CreateKnownObject(IntPtr nativeRootPeer, UInt32 customTypeId, String initializationString, IntPtr& nativePeer, UInt32 isCreatedByParser)
at MS.Internal.FrameworkCallbacks.CreateUnknownObject(String assemblyName, String typeName, IntPtr nativeRootPeer, String initializationString, UInt32& customTypeId, UInt32& coreTypeId, UInt32& typeFlags, IntPtr& nativePeer)
The correct solution is not to call Open() if Find() succeeds.
This looks very similar to a documented problem with the CTP as described by Nick Harris last April.
Solution: If you try to Open a channel almost immediately after you hit Debug when emulator fires up this issue will occur. The solution is simple – Give the emulator two minutes before making the call.
In case that's not it, there's a good article on Silverlight Show that covers push notifications in a WP7 stock quote app.

Resources