Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 525671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:41:46+00:00 2026-05-13T08:41:46+00:00

I am trying out Workflow 4.0 and hoping to write a custom activity to

  • 0

I am trying out Workflow 4.0 and hoping to write a custom activity to start an external executable, wait for that process to complete and then resume subsequent steps in the workflow.

I found the following example that shows (towards the bottom of the page) how to write an activity to waiting for a file to arrive in a specific directory:

Creating Custom Activities with Workflow 4.0

I have a couple of problems with the example. Firstly, when I add the following code:

void FileCreated(object sender, FileSystemEventArgs e)
{
    instance.ResumeBookmark(bookmarkName, e.FullPath);
    fsw.Dispose();
}

instance.Resumebookmark(...) does not seem to be available but instance.BeginResumeBookmark and instance.EndResumeBookmark are.

I am also unsure of how to change this around to deal with external processes, rather than just watching the contents of a directory.

Is this even the best approach for this kind of thing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:41:47+00:00Added an answer on May 13, 2026 at 8:41 am

    I would suggest writing an AyncCodeActivity and avoid bookmarks altogether. Here is an example of a custom activity that returns the process exit code as the result:

        public sealed class RunProcess : AsyncCodeActivity<int>
        {
            public InArgument<string> FileName { get; set; }
            public InArgument<string> Arguments { get; set; }
    
            private Func<string, string, int> runProcessAsyncCall;
    
            protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
            {
                this.runProcessAsyncCall = this.RunProcessImpl;
                return runProcessAsyncCall.BeginInvoke(FileName.Get(context), Arguments.Get(context), callback, state);
            }
    
            protected override int EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
            {
                return this.runProcessAsyncCall.EndInvoke(result);
            }
    
            private int RunProcessImpl(string fileName, string arguments)
            {
                Process p = Process.Start(fileName, arguments);
                p.WaitForExit();
                return p.ExitCode;
            }
        }
    

    In general, bookmarks are great if the external event will not come for a potentially long time. If the process you’re invoking is short-lived, an AsyncCodeActivity might be a better choice (it’s certainly an easier one to manage).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My employer is currently trying out Fogbugz and one feature that would be nice
I am trying to figure out a git workflow. At the moment we have
I'm currently trying to get into QT4 and figure out a workflow for myself.
Knocking my head against the wall trying to figure out a good workflow for
I'm trying to automate the build process for engineering group. As part of that
I am trying to figure out the right workflow for this situation: On the
I'm trying to create a workflow on the Sharepoint Designer. The workflow should wait
Possible Duplicate: TFS 2010 Custom Build Activity TF215097 error I'm trying to create a
I'm trying to work out an automated Build-Deploy-Test workflow using Lab Management/VS 2010 and
I'm trying out git for local workflow management, with an eye toward proposing it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.