Cannot create unknown type ‘{clr-namespace:MyActivityLibrary}MyCodeActivity’

I started seeing the following error in the AppFabric exceptions appearing during activation of my WF workflow.

Cannot create unknown type '{clr-namespace:MyActivityLibrary}MyCodeActivity'

The workflow completed all the steps of MyCodeActivity and the other code activities in my activity library. WF never complained; it was only an error visible in AppFabric. A Bing search resulted in the following suggestions:

  1. Create separate class libraries for activities and workflows (xamlx): already done.
  2. Place the activity library in the GAC: that should not be necessary so I skipped that one.
  3. Remove and add the activity from the workflow: again not necessary because I can see in the xaml that the namespace and the activity are fine and not appearing as a local assembly.

So it must be something else. Perhaps the unknown type error is not telling me the whole story and maybe it is failing to load/create another type referenced by my library? I went through my references and found a reference to a DLL that is not used by my activities. I removed the unnecessary reference and the errors did not return. Maybe the same thing is happening to you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.