Recently after upgrading to latest Telerik binaries in my Silverlight RIA Service application, I noticed a different behavior in the auto generated code. After searching a lot on the issue, came to know that the RoundtripOriginalAttribute was missing in the entity set.

 

As we can not add the attribute explicitly in a auto generated file, I had a tough time to find out the solution of this issue. Lately, got the solution which I am going to document it here for you.

 

Background

If you are already working in Silverlight and RIA Services, you might already know that, there is an auto generated file called “PROJECT_NAME.Web.g.cs” inside the “Generated_Code” folder under your Silverlight client project. The file automatically gets created on every build.

 

The entities present in this file has an attribute called “RoundtripOriginalAttribute” (most of the cases), but after upgrading to latest Telerik binary version I noticed that the said attribute was automatically removed from the file with the following comment:

“The following attributes were not generated: The attribute ‘System.ComponentModel.DataAnnotations.RoundtripOriginalAttribute’ is not visible in the client project ‘PROJECT_NAME’. Are you missing an assembly reference?”

RoundtripOriginalAttribute missing from the RIA Service entity

 

Actually, the issue was not due to Telerik binaries but a different System binary that RIA Service uses. In my scenario, the latest Telerik.Windows.Controls.ScheduleView.dll assembly is using Telerik.Windows.Control.dll, which again internally uses System.Windows.dll. After adding them one-by-one, my application started misbehaving.

 

First I thought, it’s due to the assemblies that I updated recently but later I was sure that, it should not be due to the Telerik assemblies that I have upgraded. After doing a hell lot of analysis, found that the System.Windows.dll that I added to the project was causing the issue.

 

Solution

So, what’s the issue? After doing a couple more analysis, I noticed that my System.Windows.dll has the “Copy Local” attribute set to “True” as shown below:

 

System.Windows.dll has CopyLocal attribute set to True

 

Just to follow a trial and error method to resolve the issue, I changed it to “False”. You won’t believe that just this small change bring back the “RoundtripOriginalAttribute” to the entities in the WCF RIA Service’s auto generated code file and everything started working properly.

 

Here is how the attribute “Copy Local” will look for System.Windows.dll assembly reference with the value “False”:

 

Set System.Windows.dll CopyLocal attribute to False

 

And when I rebuild the project, I got the [RoundtripOriginal] attribute set to the key properties of the entity set as stated in the below screenshot:

Generated DomainService of RIA Services with RoundtripOriginalAttribute in the entity set

 

Not a big deal but finding out the solution was hectic. I spent a big amount of time just to find the issue and the online forum answers didn’t give me a valid result. Thus thought to share the same here, in case you face the same issue, this will help you to resolve the problem quickly by just following the above simple step.

 

There is a proverb “Nothing is impossible in the world and the word ‘IMPOSSIBLE’ itself says ‘I M Possible’” and this is true. I hope that this post was as useful as my other blog posts and will help you to resolve the RoundtripOriginal attribute issue in your WCF RIA Services project. Let me know, if that helps.

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.