Windows Workflow Foundation 3


IndexOutOfRangeException while trying to access a workflow instance


Hi!so I've been working on a WWF workflow for about 2 months and I'm encountering the following problem from time to time with random persisted instances.The thing is that these instances become basically unusable for no obvious reasons (I can create other instances with exactly the same data in their properties without having any problem with them) and this IndexOutOfRangeException gets thrown when I'm calling the GetWorkflow function of the runtime, although sometimes (ie : if I immediatly try again after the failed one) this function works, but I'm then getting the same exception later (ie : when sending an event to the instance).From the look of the exception, it seems to have something to do with the deserialization of the instance and my guess is that there's a problem with the stored data, but I insist on the fact that I can create a similar instance (with exactly the same information) which won't have any problem.Hope you'll be able to help. Here's the exception details :+        [System.IndexOutOfRangeException]    {"Index was outside the bounds of the array."}    System.IndexOutOfRangeException+        InnerException :    null    System.Exception        IsTransient :    false    bool        Message    : "Index was outside the bounds of the array."    string        Source    : "System.Workflow.ComponentModel"    string        StackTrace : "   at System.Workflow.ComponentModel.Serialization.ActivitySurrogate.ActivitySerializedRef.System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(Object sender)\r\n                            at System.Runtime.Serialization.DeserializationEventHandler.Invoke(Object sender)\r\n                            at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()\r\n                            at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)\r\n                            at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)\r\n                            at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)\r\n                            at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)\r\n                            at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)\r\n                            at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.RestoreFromDefaultSerializedForm(Byte[] activityBytes, Activity outerActivity)\r\n                            at System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.LoadWorkflowInstanceState(Guid id)\r\n                            at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)\r\n                            at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)\r\n                            at System.Workflow.Runtime.WorkflowRuntime.GetWorkflowInstance(Guid instanceId)\r\n                            at System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)\r\n                            at testAddUser.Program.Main(String[] args) in C:\\Documents and Settings\\dschnepf\\Bureau\\projets_vs2005\\projetAdmin\\testAddUser\\Program.cs:line 127"    string-        TargetSite :    {Void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(System.Object)}    System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
The reason this is happen probably because you made changes to the workflow after it was persisted.  Are you able to persist the current definition of the workflow and then call GetWorkflow?
The reason this is happen probably because you made changes to the workflow after it was persisted.  Are you able to persist the current definition of the workflow and then call GetWorkflow?
There is no change made to the workflow after it was persisted, but still I face this same exception. What could be the reason?
Are you running a compiled project with the workflow assemblies in the GAC or known location or are you running / debugging in VS?  If in VS, after you have compiled several times there are actually multiple versions loaded.  Take a look at the Debug / Modules window.  How many versions of you workflow are loaded?  Sometimes VS gets confused and this could explain an intermittent issue.  If the problem can be reproed with a new instance on a consistent basis please put together the simplest repro you can and send it to me.  Include all sources and references needed and make sure you don’t send me anything proprietary.  What build are you using?  Do you have WinFX installed?  Have you had any previous versions of Windows Workflow Foundation installed? 
Please tell me to which email address I should send it?
Send it to tomlake at microsoft dot com.
Hi TomLake,
I sent you the projects. Were you able to figureout anything??
Regards
 
I installed WWF beta 2 only. I did not install WinFX seperately. Should I do that?
 

Related Links

RuleConditionDialog and intellisense
Workflow Persistence & Event Arguments
PersistenceService - Transaction Timeout
SimpleExpenseReport
SQLTrackingQuery from Workflow
CreateWorkflow failing validation
xbox live mic help
download code samples of Microsoft press' windows workflow foundation step by step - Kenn Scribner
Advantage and disadvantage of ASP.NET WorkFl
When do activities CANCEL and How do i force activities to cancel state?
Windows workflow 4.0 persistent issues
Windows Workflow 4
help needed in state machine workflow in asp.net
About the Role in WWF
Need suggestion of Workflow implementation
Invoking workflow from windows form

Categories

MSDN
Windows Desktop Develo...
Visual Studio Team Fou...
DevLabs
Bing
WebsitePanel
Development
Archived Forums T-U
Skype for Business
Visual Studio Graphics...
Developing Universal W...
General Windows Deskto...
Media Foundation Devel...
Peer-to-Peer Networkin...
Windows Imaging Compon...
Windows Desktop Perfmo...
Windows Desktop SDK
Open XML Format SDK
SharePoint 2013 - Gene...
SharePoint 2010 - Gene...
SharePoint Legacy Vers...
Azure Management Portal
Azure Networking (DNS,...
Azure Pack
Azure App Service - We...
Azure Automation
Azure Batch
Azure Mobile Engagement
Azure Service Fabric
Azure Security Center
Team Foundation Server...
Team Foundation Server...
Software Modeling Tools
BizTalk Server EDI and...
Microsoft Live Labs Volta
Scripting
Microsoft Translator H...
Visual Basic for Appli...
Small Basic
SQL Server SMO/DMO
SQL Server Compact
SQL Server Data Wareho...
SQL Server Search
Standard 7: Components...
Windows Embedded Compa...
SQL Server 2012 Analys...
SQL Server 2012 SQL To...
Server Virtualization
Windows Live Messenger...
Dynamics 365 for Custo...
MSDN and TechNet Searc...
App Linking
Windows Protocols
Open Specifications Qu...
Office Protocols
Project Server General...
Project Server - Setup...
Bing Ads API: Development
Microsoft Unified Comm...
Silverlight 5
Visual Studio & Silver...
Silverlight for Window...
Expression Web and Sup...
Connected Services Fra...
Windows Performance To...
Retired SharePoint Col...
.NET Framework 4 Appli...
.NET StockTrader Sampl...
Announcements about pr...
Architecture, Tools, a...
Building Windows Store...
Casablanca
CAT.NET
Core Coding Experience...
LINQ Project General
Microsoft ESP Platform...
Microsoft Security Dev...
Microsoft Security Dev...
Microsoft Unified Comm...
Multimap API Developme...
Office Live Small Busi...
Office Live Small Busi...
Oracle on Azure
POS for .NET
Search Server: Federation
Share your How to samp...
Team Foundation Server...
Using Visual Round Tri...
UI Design for Windows ...
Visual Basic Power Packs
Visual Studio Database...
Visual Studio Team Sys...
Visual Studio Online "...
Web Sandbox - General
Windows SideShow Devel...
Building Windows Store...
Mango Update (Archived)
Expression Blend for W...
XML in Visual Studio 2...
XML in Windows (MSXML ...
Reporting
Windows Phone Preview SDK
SQL Server 2016 Preview

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile