Got error in "Invoke Code" Activity

Repro steps:

  1. Create new sequence workflow.
  2. Create a nested sequence inside of it (named inner for clarity).
  3. In inner create a DataTable variable named testDT.
  4. In inner add a WriteLine activity: testDT.AsEnumerable().Count().ToString()
    (at this point everything works)
  5. RMB click inner → select Extract as workflow, name new workflow inner
  6. In new workflow there will be a validation error ~.AsEnumerable() is not a member of System.Data.DataTable

extractionTest.xaml (4.8 KB)
inner.xaml (4.1 KB)

On examining .xaml content, following line is “missing” from inner.xaml:
<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>

This line gets added if the compiler finds usage of anything from that .dll (namespace is still System.Data), but only during actual writing of the code.
Since System.Data namespace is already present, it cannot be added.

/endrepro

Similar issue I think can happen with System.IO.Compression.FileSystem.dll, as it also has a shared namespace with System.IO.Compression.dll - see this topic.

2 Likes