本文介绍了为什么在workflowapplication运行调用后使用Thread.Sleep的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨 我正在使用WorkflowApplication在WF.Invoking工作流程中使用statemachine。 after通过instance.Run()方法创建实例并调用工作流。 然后我调用instance.unload()。当运行方法调用相应的codeActivity时,我执行的地方正在创建书签。 但工作流程意外中止并转向执行状态。 当我保持Thread.Sleep(新TimeSpan(0,0,5))然后它正在工作。 我的代码是这样的 WorkflowApplication instance = new WorkFLowApplication(); // 仅示例代码 instance.store = somestorename; instance.complete + = event ; instance.run(); Thread.Sleep( new TimeSpan( 0 , 0 , 5 )) instance.unload(); 只保持Thread.Sleep(新的TimeSpan(0,0,5))正常工作。即使用一些业务逻辑执行代码活动并创建书签。 但我认为使用Thread.Sleep是不正确的设计方式。 即使我尝试使用SynchroniseContext将workflowapplication设置为同步。 但没有成功... 请帮忙解决这个解决方案 HiI am working on statemachine in WF.Invoking workflow using WorkflowApplication.after creating instance and calling workflow by instance.Run() method.Then instance.unload() i am calling.When run method called respective codeActivity is getting executed where i am creating the bookmarks.But workflow aborts unexpectingly and moving to executing status.when i keep Thread.Sleep(new TimeSpan(0,0,5)) then it is working.My code is like thisWorkflowApplication instance = new WorkFLowApplication();// sample code onlyinstance.store = somestorename;instance.complete += event;instance.run();Thread.Sleep(new TimeSpan(0,0,5))instance.unload();only by keeping Thread.Sleep(new TimeSpan(0,0,5)) its working properly. i.e. executing codeactivities with some business logic and creating bookmarks.But i think using Thread.Sleep is not correct way of design.Even i tried with making workflowapplication as synchronous by using SynchroniseContext.but no success...Please help on this 解决方案 这篇关于为什么在workflowapplication运行调用后使用Thread.Sleep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!