This project has moved and is read-only. For the latest updates, please go here.

How to return TaskDefinition in WCF method?

Topics: Errors, Examples
Nov 11, 2015 at 1:36 AM
Edited Nov 11, 2015 at 1:37 AM
On version Followed service definition would get error

Type 'Microsoft.Win32.TaskScheduler.TaskDefinition' cannot be IXmlSerializable and have DataContractAttribute attribute.
    public interface IService1
        void DoWork();

        TaskDefinition GetTask();    //this will fail
Reads TaskDefinition's attributes
    /// <summary>
    /// Defines all the components of a task, such as the task settings, triggers, actions, and registration information.
    /// </summary>
    [XmlRootAttribute("Task", Namespace = TaskDefinition.tns, IsNullable = false)]
    [DataContract(Name = "Task", Namespace = TaskDefinition.tns)]
    public sealed class TaskDefinition : IDisposable, IXmlSerializable
Nov 11, 2015 at 4:20 PM
I believe this is the result of a bug I introduced in 2.5. I have removed it in 2.5.3 which is now available.
Marked as answer by dahall on 11/11/2015 at 8:20 AM