Sql – Using Guid in ADO.Net Data Service

guidlinq-to-sqlwcf-data-services

I'm pulling my hair out on this one. I'm trying to implement a ADO.Net Data Service that uses a Linq to SQL data context. I thought I had it working, but the URL for one of my tables always gets an exception.

The obvious difference between the table that isn't working and the ones that are, is that the one getting the exception is using a Guid, which is the primary key. The Guid is a UserID, which actually relates to the UserId used by ASP.net Membership. (I'm not exposing the ASP.net Membership tables, but I'm guessing these would break too if I were.)

It is a very simple table:
Name: UserDetails :: | Guid UserID | int GroupID (foreign key) | string Name |

Anybody know if there's a trick to getting Guids to work? Or if maybe this is an entirely different problem?

Here's the exception from the service:
An error occurred while processing this request.

InnerError: An error occurred while processing this request.

Type: System.InvalidOperationException

StackTrace:
t System.Data.Services.Serializers.SyndicationSerializer.WriteComplexObjectValue(Object element, String propertyName, ResourceType expectedType, String relativeUri, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteComplexObjectValue(Object element, String propertyName, ResourceType expectedType, String relativeUri, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteComplexObjectValue(Object element, String propertyName, ResourceType expectedType, String relativeUri, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content)
at System.Data.Services.Serializers.SyndicationSerializer.WriteEntryElement(IExpandedResult expanded, Object element, Type expectedType, Uri absoluteUri, String relativeUri, SyndicationItem target)
at System.Data.Services.Serializers.SyndicationSerializer.<DeferredFeedItems>d__0.MoveNext()
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteItems(XmlWriter writer, IEnumerable`1 items, Uri feedBaseUri)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeedTo(XmlWriter writer, SyndicationFeed feed, Boolean isSourceFeed)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeed(XmlWriter writer)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteTo(XmlWriter writer)
at System.Data.Services.Serializers.SyndicationSerializer.WriteTopLevelElements(IExpandedResult expanded, IEnumerator elements, Boolean hasMoved)
at System.Data.Services.Serializers.Serializer.WriteRequest(IEnumerator queryResults, Boolean hasMoved)
at System.Data.Services.ResponseBodyWriter.Write(Stream stream)

Best Answer

That looks like a bug. I suggest you report it at http://connect.microsoft.com/visualstudio/, then post the URL of your bug report here, so we can vote on it.