web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Operation is not valid due to the current state of the object.

(0) ShareShare
ReportReport
Posted on by 55

Hi,

My client is on Dynamics CRM 2016 online. They are experiencing a very weird workflow exception and behaviour. The have couple of workflows scheduled to be run and certain interval during the day, but when these workflows are due to run they suddenly get postponed 12/30/9999. All of the scheduled workflows in the system are experiencing the same behaviour.

See Exception below, Anyone one with any idea to this behaviour?

Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object.

at Microsoft.Compiler.VisualBasic.CompilerBridge.CompileExpression(CompilerBridge* , gcroot<System::String ^>* expression, gcroot<Microsoft::Compiler::VisualBasic::CompilerContext ^>* context, gcroot<System::Type ^>* targetType, gcroot<Microsoft::Compiler::VisualBasic::CompilerResults ^>* results)

at Microsoft.Compiler.VisualBasic.HostedCompiler.CompileExpression(String expression, CompilerContext context, Type targetType)

at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](LocationReferenceEnvironment environment, Boolean isLocationReference)

at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationReference)

at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](String expressionText, CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationExpression)

at Microsoft.VisualBasic.Activities.VisualBasicValue`1.CacheMetadata(CodeActivityMetadata metadata)

at System.Activities.CodeActivity`1.OnInternalCacheMetadataExceptResult(Boolean createEmptyBindings)

at System.Activities.Activity`1.OnInternalCacheMetadata(Boolean createEmptyBindings)

at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)

at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)

at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)

at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)

at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)

at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)

at System.Activities.WorkflowApplication.SetPersistenceManager(PersistenceManager newManager)

at System.Activities.WorkflowApplication.CreatePersistenceManager()

at System.Activities.WorkflowApplication.Load(Guid instanceId, TimeSpan timeout)

at System.Activities.WorkflowApplication.Load(Guid instanceId)

at Microsoft.Crm.Workflow.ActivityHost.StartWorkflowExecution(Activity workflow, ICommonWorkflowContext context)

at Microsoft.Crm.Workflow.ActivityHostBase.StartWorkflow(ICommonWorkflowContext context, Activity preLoadedActivity)

*This post is locked for comments

I have the same question (0)
  • James AT Hallstudios Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    Also getting this issue over the past few days, seems to come and go.

  • Community Member Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    Yes, the issue is intermittent. 17/1 and 15/1, I faced the same problem in some workflows !!! 

  • Community Member Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    Issue is intermittent. few workflows are failing again and again.

  • Community Member Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    I don't know why, but the workflows works this morning. The issue is gone, I didn't do anything

  • Edin Malkoc Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    I don't know if this was the reason or if the issue is completely gone but it looks good now after we removed Marketing solutions. They were installed 2 days ago. I hope this helps.

    If you need information how to remove them: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/marketing/uninstall-marketing

  • Community Member Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    same issue on same version, 1710 (9.1.0.1121) online.

    Any solution?

  • Edin Malkoc Profile Picture
    on at
    RE: Operation is not valid due to the current state of the object.

    Same issue here on Version 1710 (9.1.0.1121) online. Some workflows are failing with "Operation is not valid due to the current state of the object." Came out of nowhere.

  • sclarebout Profile Picture
    180 on at
    RE: Operation is not valid due to the current state of the object.

    Just encountering the same issue with Dynamics 365 v9 right now. Some workflows fail with the same error code:

    Message: Operation is not valid due to the current state of the object.

    Anyone else? Any solution?

  • ArdantHammer Profile Picture
    372 on at
    RE: Operation is not valid due to the current state of the object.

    We just had this issue a few weeks ago. All or almost all workflows seemed to get delayed with this exact exception. Lasted about 23 hours. Then it just stopped. We are online so it is really strange. Anyone ever find out additional information on this?

  • Suggested answer
    sandeepstw Profile Picture
    4,601 on at
    RE: Operation is not valid due to the current state of the object.

    Hi,

    Please check in work flow, you are trying to update any entity attributes, it looks like you are trying to update attribute more than it's size.

    You can also on sql server profile and check. You might get solution.

    Thanks,

    Sandeep

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans