c# - Workflow background thread - how to wait -
i have persistent workflow (runned workflowapplication class) , need unit test correctness of runnung workflow.
i running workflow unit test , runs fine, except receive error message in output window:
system.appdomainunloadedexception: attempted access unloaded appdomain. can happen if test(s) started thread did not stop it. make sure threads started test(s) stopped before completion.
i want test results of workflow run after persisted , unloaded, use code this:
autoresetevent waithandle = new autoresetevent(false); workflowapplication wfapp = new workflowapplication(workflowtypeinstance, inputs); wfapp.unloaded = delegate(workflowapplicationeventargs e) { waithandle.set(); }; // .... wfapp.run(); waithandle.waitone();
the problem is, workflow application background thread not terminate right after unload of workflow, test method does. causes error message in output window.
any idea / approach / point how wait background thread termination?
Comments
Post a Comment