Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Workflow Failed at wait condition for child activity complete after upgrade from CRM2016 8.1.1 to D365 8.2.2

Posted on by 215

i noticed one issue in our all workflows which having below highlighted wait condition .

Issue 1 : Wait condition take 10 -20 mins after condition met then execute workflow .This started after installing SP1.1 (crm2016 8.1.1)

issue 2: Wait condition failed after upgrading from CRM 8.1.1 to CRM 8.2.2 .  Workflow details and trace error message below

Trace Error

     at CrmException..ctor(String message, Exception innerException)  ilOffset = 0xF
                at MetadataCache.LoadCache(IOrganizationContext context, Boolean fileOnlyIfExists)  ilOffset = 0xF3
                at MetadataCache.GetInstance(IOrganizationContext context)  ilOffset = 0x9A
                at AsyncOperationQueueDataAccess.GetEntityLogicalNameFromObjectTypeCode(Int32 objectTypeCode)  ilOffset = 0x10
                at AsyncOperationQueueDataAccess.GetLookup(Object objectId, String objectIdName, Int32 objectTypeCode)  ilOffset = 0x5
                at <>c__DisplayClass5.<SelectEvents>b__1(Object[] values)  ilOffset = 0x57
                at DataAccessBase.ExecuteSqlCommandAndProcessRecords(IDbCommand command, RecordProcessor recordProcessor, Guid inputOrganizationId)  ilOffset = 0x9F
                at DataAccessBase.ExecuteSqlCommandAndProcessRecords(IDbCommand command, RecordProcessor recordProcessor)  ilOffset = 0x0
                at <>c__DisplayClass5.<SelectEvents>b__0(IServiceOperation operation)  ilOffset = 0x1D
                at OrganizationOperation.<get_EventAction>b__0(IServiceOperation operation)  ilOffset = 0x0
                at FaultToleranceBehavior.Execute(ServiceOperationAction operation, IServiceOperation operationParameter)  ilOffset = 0x18
                at IsolatedOperation.Execute()  ilOffset = 0x27
                at MonitoredOperation.Execute()  ilOffset = 0xD
                at AsyncOperationQueueDataAccess.SelectEvents(Int32 numberOfEvents)  ilOffset = 0x123
                at SynchronousQueueManager`1.SelectEvents(IOrganizationConfiguration orgConfig, Int32 orgCapacity)  ilOffset = 0x8
                at SynchronousQueueManager.OnSelectPerOrganization(IOrganizationConfiguration orgConfig, Int32 orgCapacity)  ilOffset = 0x1E
                at OutstandingOperationAwareWorkloadThrottler.AllocateWorkForOrganization(WorkloadThrottlingInformation orgThrottlingInformation, Int32 allocatedCapacity, AsyncSelectExecutionTracker selectExecutionTracker)  ilOffset = 0x5A
                at WorkloadThrottler.HandleIdleOrganization(WorkloadThrottlingInformation orgPollingInfo, Int32 effectiveMinimumPriority, AsyncSelectExecutionTracker selectExecutionTracker)  ilOffset = 0x34
                at <>c__DisplayClass5.<AllocateWork>b__2(IServiceOperation operation)  ilOffset = 0x36
                at OrganizationOperation.<get_EventAction>b__0(IServiceOperation operation)  ilOffset = 0x0
                at FaultToleranceBehavior.Execute(ServiceOperationAction operation, IServiceOperation operationParameter)  ilOffset = 0x18
                at IsolatedOperation.Execute()  ilOffset = 0x27
                at MonitoredOperation.Execute()  ilOffset = 0xD
                at ParallelTasksExecutionEngine.ExecuteOperation(IServiceOperation serviceOperation)  ilOffset = 0x18
                at <>c__DisplayClass17_0`1.<ForWorker>b__1()  ilOffset = 0x11A
                at Task.InnerInvokeWithArg(Task childTask)  ilOffset = 0x6
                at <>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )  ilOffset = 0x86
                at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x79
                at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x9
                at Task.ExecuteWithThreadLocal(Task& currentTaskSlot)  ilOffset = 0xE1
                at Task.ExecuteEntry(Boolean bPreventDoubleExecution)  ilOffset = 0x96
                at ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)  ilOffset = 0xF
                at TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)  ilOffset = 0x4C
                at Task.InternalRunSynchronously(TaskScheduler scheduler, Boolean waitForCompletion)  ilOffset = 0x83
                at Parallel.ForWorker(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)  ilOffset = 0x1A9
                at Parallel.ForEachWorker(IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)  ilOffset = 0x44
                at Parallel.ForEach(IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)  ilOffset = 0x2A
                at ParallelTasksExecutionEngine.StartOperation()  ilOffset = 0x19
                at WorkloadThrottler.AllocateWork(CancellationToken cancellationToken)  ilOffset = 0x1FE
                at SynchronousQueueManager.OnSelectTimerEvent(CancellationToken token)  ilOffset = 0x3A
                at OrganizationOperation.<get_EventAction>b__0(IServiceOperation operation)  ilOffset = 0x0
                at FaultToleranceBehavior.Execute(ServiceOperationAction operation, IServiceOperation operationParameter)  ilOffset = 0x18
                at IsolatedOperation.Execute()  ilOffset = 0x27
                at MonitoredOperation.Execute()  ilOffset = 0xD
                at TimerBasedExecutionEngine.OnTimerEvent(Object sender, ElapsedEventArgs e)  ilOffset = 0xC
                at Timer.InvokeElapsedWithCancellationToken(Object state)  ilOffset = 0x1D
                at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x79
                at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x9
                at QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()  ilOffset = 0x35
                at ThreadPoolWorkQueue.Dispatch()  ilOffset = 0xA4
Crm Exception: Message: An item with the same key has already been added., ErrorCode: -2147220970, InnerException: System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Microsoft.Crm.Metadata.PreloadedOptionSetMetadataDataProvider.LoadNormalOptions(IPreloadedMetadataInitializationContext context, Boolean initializeEnumOptionProvider)
   at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.InitializeOptionSets(IPreloadedMetadataInitializationContext context, LoadMasks masks, IOrganizationContext organizationContext)
   at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.Initialize(IOrganizationContext organizationContext, MetadataContainer container, LoadMasks masks)
   at Microsoft.Crm.Metadata.MultiOrgSharableMetadataCacheLoader.CreateMetadataCacheDataProvider(MetadataContainer container, LoadMasks masks, CounterList counter)
   at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.BuildMetadataCacheFromMetadataContainer(MetadataContainer container, LoadMasks masks, CounterList counter)
   at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, CounterList counter)
   at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, CounterList counter)
   at Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, IOrganizationContext context)
   at Microsoft.Crm.Metadata.MetadataCache.LoadCache(IOrganizationContext context, Boolean fileOnlyIfExists)
0407.image001.png

*This post is locked for comments

  • Verified answer
    linu John Profile Picture
    linu John 215 on at
    RE: Workflow Failed at wait condition for child activity complete after upgrade from CRM2016 8.1.1 to D365 8.2.2

    Thank you  Issue No. 2 . found root cause and fixed .

    ie: Wait condition failed after upgrading from CRM 8.1.1 to CRM 8.2.2 .  Workflow details and trace error message below

    But Issue No.1 . still exist .

    ie : Issue 1 : Wait condition take 10 -20 mins after condition met then execute workflow

  • Verified answer
    Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: Workflow Failed at wait condition for child activity complete after upgrade from CRM2016 8.1.1 to D365 8.2.2

    Hello,

    Based on the exception Crm Exception: Message: An item with the same key has already been added., ErrorCode: -2147220970, InnerException: System.ArgumentException: An item with the same key has already been added. and the callstack :

       at Microsoft.Crm.Metadata.PreloadedOptionSetMetadataDataProvider.LoadNormalOptions(IPreloadedMetadataInitializationContext context, Boolean initializeEnumOptionProvider)

       at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.InitializeOptionSets(IPreloadedMetadataInitializationContext context, LoadMasks masks, IOrganizationContext organizationContext)

    It seems you have an issue with the MetadataCache for some OptionSets - caused by some duplicate entries within the CRM Database / incorrect solution layering.

    From experience unless this is a known bug fixed via an Update Rollup, then the safest and fastest way to get a fix for this is either get a memory dump of the exception and have MS Support analyze it or provide a db copy to MS Support and have them do live debugging.

    Else it's trial and error and you need to get lucky. If you want, you can spin a new CRM Organization and look directly in the database within the MetadataSchema tables - I would start with the OptionSet and compare the out of the box system components from the new CRM Organization with the components from your faulty CRM Organization. See what differences you find (SolutionId, ComponentState, etc. and see if you manage to identify the faulty component.)

    Hope this helps!

    Radu

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans