activity could not be loaded because of errors in the XAML

Joseph Caruana picture Joseph Caruana · May 11, 2012 · Viewed 7.3k times · Source

Considering the following scenario:

  1. Create MyCodeActivity1 with argument MyArgument1
  2. Add this activity to a myworkflow.xaml
  3. Rename MyArgument1 in MyCodeActivity1 to MyRenamedArgument1

If you open myworkflow.xaml, visual studio will show this error:

activity could not be loaded because of errors in the XAML

Is there a facility where visual studio can give more information about the error please? For now I have created a small windows application that tries to execute the workflow and shows an error message if invalid. This does give a clear message. But it would be great if visual studio provided this functionality directly.

Answer

user1228 picture user1228 · May 11, 2012

No.

Nope.

Nuh uh.

Visual Studio's refactoring can't handle change in Activity code => change in XamlAppDef XML. Its not surprising, such a chain of logic would be complex to achieve. So whenever you do this you must expect your workflows will have to be fixed. Either plan ahead, or...

Any time a workflow won't compile, or if it shows the red box of pain in the design surface, you should always right click on the workflow file, select Open With... and select the XML (text) editor. You will see the squiggly error lines and more detail about the error in this view.