I just ran into a problem when trying to use Workflow Persistence with Self Tracking Entities in .NET 4.0 RC.
The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error. ---> System.Runtime.Serialization.InvalidDataContractException: Type ‘ElasticSoftware.DownloadSheriff.Domain.Model.Entities.TrackableCollection`1[ElasticSoftware.DownloadSheriff.Domain.Model.Entities.Customer]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
By Default the TrackableCollection in the Types.tt is not annotated with a DataContract attribute.
You can fix this by going to Line 1401 and adding the DataContract attribute like so:
[DataContract] public class TrackableCollection<T> : ObservableCollection<T>
Then regenerate from your T4 templates and you should be good to go.