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

  • Home
  • SEARCH
  • 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 1059251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:08:35+00:00 2026-05-16T18:08:35+00:00

Full code: using System; using System.Linq; using System.Activities; using System.Activities.Statements; namespace ManyAssemblies { class

  • 0

Full code:

using System;
using System.Linq;
using System.Activities;
using System.Activities.Statements;

namespace ManyAssemblies {

  class Program {

    public sealed class SayHelloActivity : Activity {
      readonly WriteLine writeLine = new WriteLine() { Text = "Hello Workflow 4" };
      public SayHelloActivity() {
        Implementation = () => { return writeLine; };
      }
    }


    static void Main(string[] args) {
      var wfDefinition = new SayHelloActivity();

      for (int i = 0; i < 100; i++) {
        WorkflowInvoker.Invoke(wfDefinition);
      }

      var allLoadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
      int wfAssemblesCount = allLoadedAssemblies
        .Where(a => a.FullName == 
"Workflow, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").Count();
      Console.WriteLine(string.Format("There are {0} workflow assemblies in app domain.", wfAssemblesCount));
      Console.ReadLine();
    }
  }
}

The output from this code:

...
Hello Workflow 4
Hello Workflow 4
Hello Workflow 4
There are 100 workflow assemblies in app domain.

Every execution of wf definition creates new dynamic assembly that is loaded in current app domain.
Why? Definition is always the same so this is not necessary, IMO. Is this a design flaw in WF4? Can this behavior be controlled?

I’m building a host for workflow instances. And this host must be up and running for long time, like months. Will I end up with app domain with many thousands of dynamic assemblies, even if there are only just few workflow definitions? Will this kill my performance and use up my memory?

  • 1 1 Answer
  • 2 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-16T18:08:35+00:00Added an answer on May 16, 2026 at 6:08 pm

    It turns out that this is because of attached debugger.

    If I run the code directly in command prompt, in that case there were no “Workflow, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null” assemblies in app domain.

    Interesting that there is none.

    Does this mean that on every WorkflowInvoker.Invoke(wfDefinition); there is building of dynamic assembly that is unloaded upon instance competition ?

    But this is an implementation detail that probably doesn’t influence performance of an wf app.

    Thanks for help tilovell

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

Sidebar

Related Questions

I'm trying to execute a simple test code: using System; using System.IO; using System.Linq;
Ho to make this simple xml with php using DOM? Full code will be
I am using the following code for adding full permission for the image files
I am using the following code to set the full permission for a file
Directory.GetFiles(targetDirectory); Using the above code we get the names( i.e full path) of all
Here's some code (full program follows later in the question): template <typename T> T
UPDATE 1: Here is the full code behind from the downloaded example, unedited: using
I have the following simple code for testing a webservice : using System; using
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
I tried to do it this: $(this + ' li:not(:nth-last-child(2)):not(:last-child)').hide() Full code sample: $('.comments').each(function(){

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.