Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array from CRM 2011 Plugins

Soru Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array from CRM 2011 Plugins

  • 15 Haziran 2012 Cuma 17:41
     
     

    Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array from Plugins

    I am getting the following below from time to time. Not sure how to fix it. If I reset IIS then it starts working again.

    Plugin Trace:

    [MY_Plugins: MY_Plugins.BatchPostFinancialInstrumentsTrxUpdate]
    [074182e3-2888-e111-8674-0050569d49a5: MY_Plugins.BatchPostFinancialInstrumentsTrxUpdate: Update of MY_batch]
    Before oFinancialInstrTrx.UpdateFinancialInstrumentTransactionIntegrationAPI
    Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at System.Collections.Generic.List`1.get_Item(Int32 index)
    at System.Collections.Generic.KeyedByTypeCollection`1.Find[T](Boolean remove)
    at System.ServiceModel.Dispatcher.TransactionValidationBehavior.ValidateTransactionFlowRequired(String resource, String name, ServiceEndpoint endpoint)
    at System.ServiceModel.Dispatcher.TransactionValidationBehavior.System.ServiceModel.Description.IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint)
    at System.ServiceModel.Description.ServiceEndpoint.Validate(Boolean runOperationValidators, Boolean isForService)
    at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
    at System.ServiceModel.ChannelFactory.CreateFactory()
    at System.ServiceModel.ChannelFactory.OnOpening()
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.ChannelFactory.EnsureOpened()
    at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.CreateChannel()
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.ConfigureNewChannel()
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.get_Channel()
    at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1.Initialize(ServiceProxy`1 proxy)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceContextInitializer..ctor(OrganizationServiceProxy proxy)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
    at Microsoft.Xrm.Client.Services.OrganizationService.InnerOrganizationService.UsingService[TResult](Func`2 action)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.InnerExecute(OrganizationRequest request)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute[TRequest,TResponse,TResult](TRequest query, Func`2 execute, Func`2 selector)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.<>c__DisplayClass6`3.<LookupAndInsert>b__4(ObjectCache cache)
    at Microsoft.Xrm.Client.Caching.ObjectCacheManager.<>c__DisplayClass9`1.<Get>b__8(String key)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.<>c__DisplayClass5`1.<Get>b__3(Mutex _)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action`1 action)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Func`2 loadFromCache, Func`2 loadFromService)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.LookupAndInsert[TRequest,TResponse,TResult](TRequest query, Func`2 execute, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute[TRequest,TResponse,TResult](TRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute[T](OrganizationRequest request, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute[T](OrganizationRequest request)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at MY.BusinessObjects.FinancialInstTrxService.UpdateFinancialInstrumentTransactionIntegrationAPI(Guid batchId, IOrganizationService service)
    at MY_Plugins.BatchPostFinancialInstrumentsTrxUpdate.Execute(IServiceProvider serviceProvider)


    Error Message:

    Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: Index was outside the bounds of the array.
    at Microsoft.Crm.Asynchronous.EventOperation.CreateAsyncResultFromException(AsyncExecutionContext context, Exception e)
    at Microsoft.Crm.Asynchronous.EventOperation.InvokePlugin(AsyncExecutionContext context, IPlugin pluginInstance)
    at Microsoft.Crm.Asynchronous.EventOperation.InternalExecute(AsyncEvent asyncEvent)
    at Microsoft.Crm.Asynchronous.AsyncOperationCommand.Execute(AsyncEvent asyncEvent)
    at Microsoft.Crm.Asynchronous.QueueManager.PoolHandler.ProcessAsyncEvent(AsyncEvent asyncEvent)
    Inner Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at System.Collections.Generic.List`1.get_Item(Int32 index)
    at System.Collections.Generic.KeyedByTypeCollection`1.Find[T](Boolean remove)
    at System.ServiceModel.Dispatcher.TransactionValidationBehavior.ValidateTransactionFlowRequired(String resource, String name, ServiceEndpoint endpoint)
    at System.ServiceModel.Dispatcher.TransactionValidationBehavior.System.ServiceModel.Description.IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint)
    at System.ServiceModel.Description.ServiceEndpoint.Validate(Boolean runOperationValidators, Boolean isForService)
    at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
    at System.ServiceModel.ChannelFactory.CreateFactory()
    at System.ServiceModel.ChannelFactory.OnOpening()
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.ChannelFactory.EnsureOpened()
    at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.CreateChannel()
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.ConfigureNewChannel()
    at Microsoft.Xrm.Sdk.Client.ServiceChannel`1.get_Channel()
    at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1.Initialize(ServiceProxy`1 proxy)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceContextInitializer..ctor(OrganizationServiceProxy proxy)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
    at Microsoft.Xrm.Client.Services.OrganizationService.InnerOrganizationService.UsingService[TResult](Func`2 action)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.InnerExecute(OrganizationRequest request)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute[TRequest,TResponse,TResult](TRequest query, Func`2 execute, Func`2 selector)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.<>c__DisplayClass6`3.<LookupAndInsert>b__4(ObjectCache cache)
    at Microsoft.Xrm.Client.Caching.ObjectCacheManager.<>c__DisplayClass9`1.<Get>b__8(String key)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.<>c__DisplayClass5`1.<Get>b__3(Mutex _)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action`1 action)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService)
    at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Func`2 loadFromCache, Func`2 loadFromService)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.LookupAndInsert[TRequest,TResponse,TResult](TRequest query, Func`2 execute, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute[TRequest,TResponse,TResult](TRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute[T](OrganizationRequest request, Func`2 selector, String selectorCacheKey)
    at Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute[T](OrganizationRequest request)
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
    at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at MY.BusinessObjects.FinancialInstTrxService.UpdateFinancialInstrumentTransactionIntegrationAPI(Guid batchId, IOrganizationService service)
    at MY_Plugins.BatchPostFinancialInstrumentsTrxUpdate.Execute(IServiceProvider serviceProvider)
    at Microsoft.Crm.Asynchronous.V5ProxyPlugin.Execute(IServiceProvider serviceProvider)
    at Microsoft.Crm.Asynchronous.EventOperation.InvokePlugin(AsyncExecutionContext context, IPlugin pluginInstance)

Tüm Yanıtlar

  • 16 Haziran 2012 Cumartesi 17:57
     
     

    Hello,

    Can you place the logic of your code here, so that we can have look into it?

    Thanks.


    Regards, Vishnu Turlapati http://blogs.technet.com/b/tvishnun1/