none
Windows 10: Build 10122 and later: WCF RIA Services Code Generator broken for DataMembers with Name field RRS feed

  • Question

  • Starting with build 10122 the WCF RIA Services (v1.0 SP2) code generation is not working anymore when using DataMembers with a specified name.

    This issue can easily be reproduced by creating a Silverlight Business Application (using the Template in Visual Studio 2013) and modifying any of the Model classes e.g. Test.Web\Models\RegistrationData.cs from


    public string UserName{ get; set; }

    to

    [DataMember(Name="Test")]

    public string UserName{ get; set; }

    Now the resulting generated code file (Test\Generated_Code\Test.Web.g.cs) will be wrong as the UserName property will not contain the DataMember attribute anymore which makes it impossible to serialize and deserialize the object!

    ///<summary>

    ///Gets or sets the 'UserName' value.

    ///</summary>

    [Display...]

    [RegularExpression...]

    [Required...]

    [StringLength...]

    public string UserName...

    Stopping the usage of "Name" is not possible as the amount of data which will be transferred between server and client will drastically increase.

    NOTE: We also observed, that sometimes the DataMember attribute gets generated but WITHOUT the name.

    Thanks a lot in advance!

    NOTE: This is a cross post of

    http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_web/build-10122-and-later-wcf-ria-services-code/7126f05d-7f99-4934-8b4a-37225f205ad2 

    as suggested by the Windows Insider Program Community.


    • Edited by Andi_915 Wednesday, June 10, 2015 9:52 AM
    Wednesday, June 10, 2015 9:52 AM

All replies

  • Hi Andi_915,
       As per this case, you can try like below :

    [DataMember(Name="Test")]
    public string UserName;
    

     The Name property on the DataMemberAttribute is set to "Test".
    Click here to know more about DataMemberAttribute Class

    Click here to refer the article which explains about WCF RIA Services in detail. 

    Thursday, June 11, 2015 5:57 AM
  • Hi Edwin Guru Singh,

    sorry maybe my question was not specific enough. So I try to be more specific. If I use

    [DataMember(Name="Test")]

    public string UserName{ get; set; }

    in my Model class I expect that the generated class in Test\Generated_Code\Test.Web.g.cs also has the [DataMember(Name="Test")] Attribute put on top of  public string UserName{ get; set; }. This is unfortunately not the case. Instead the DataMember Attribute is totally missing. This makes it impossible to deserialize the data contract on Client side, as the deserializer just ignores all data in the <Test>some data</Test> tags as it doesn't know to which member <Test>some data</Test> shall be mapped.

    Wednesday, July 1, 2015 12:03 PM
  • hi Andi,
       According to your case, I suggest you to refer the following thread link which may give idea to resolve this case :
    http://stackoverflow.com/questions/3760312/ria-domainservice-not-generating-client-code-using-datacontracts

    Thursday, July 2, 2015 9:04 AM