Hello,On an ASP.NET MVC project I am getting a list of Tags which names start with a string contained on the variable "q".Everything works fine if no Post is related to Tags.When there is relation I start to get a Circular Reference error.I have been trying to solve this problem for days!I can't find the reason for this, either in my SQL or C# code.I am posting both codes ... just in case:C# LINQ code: public JsonResult Filter(string q, int limit) { var list = (from t in database.Tags where t.Name.StartsWith(q) orderby t.Name select t); List<Tag> tags = (limit > 0 ? list.Take(limit) : list).ToList(); return this.Json(tags); }SQL Tables:-- Filescreate table dbo.Files( FileID uniqueidentifier not null constraint PK_File primary key clustered, CreatedAt datetime null, Description nvarchar(2000) null, IsPublished bit null, Path nvarchar(800) null, Title nvarchar(400) null, UpdatedAt datetime null)-- Postscreate table dbo.Posts( PostID uniqueidentifier not null constraint PK_Post primary key clustered, Body nvarchar(max) null, CreatedAt datetime null, IsPublished bit null, Title nvarchar(400) null, UpdatedAt datetime null)-- Tagscreate table dbo.Tags( TagID uniqueidentifier not null constraint PK_Tag primary key clustered, [Name] nvarchar(100) null)-- FilesTagscreate table dbo.FilesTags( FileID uniqueidentifier not null, TagID uniqueidentifier not null, constraint PK_FilesTags primary key clustered (FileID, TagID), constraint FK_FilesTags_Files foreign key(FileID) references dbo.Files(FileID) on delete cascade, constraint FK_FilesTags_Tags foreign key(TagID) references dbo.Tags(TagID) on delete cascade)-- PostsTagscreate table dbo.PostsTags( PostID uniqueidentifier not null, TagID uniqueidentifier not null, constraint PK_PostsTags primary key clustered (PostID, TagID), constraint FK_PostsTags_Posts foreign key(PostID) references dbo.Posts(PostID) on delete cascade, constraint FK_PostsTags_Tags foreign key(TagID) references dbo.Tags(TagID) on delete cascade)
DATA in Tables (All other tables are empty):Posts PostID: 78ef0b05-ca4c-4df8-88c9-2858d24fa4e3 Body: <p>Test</p> CreateAt: 03-09-2008 22:35:25 IsPublished: True Title: This is the title UpdatedDate: 03-09-2008 22:35:25Tags TagID: e2ec18a7-d668-477b-977b-183989df2a65 Name: Net TagID: dbf4465a-d0f6-4145-831d-b1ce1363dd16 Name: New York TagID: 0ea15666-155b-4237-a871-d905a2685f45 Name: AustraliaPostsTags TagID: e2ec18a7-d668-477b-977b-183989df2a65 PostID: 78ef0b05-ca4c-4df8-88c9-2858d24fa4e3 TagID: dbf4465a-d0f6-4145-831d-b1ce1363dd16 PostID: 78ef0b05-ca4c-4df8-88c9-2858d24fa4e3My Linq code is automaticly generated by LinqToSQL in VS2008.I don't see any problem in my code or data but I get the error:A circular reference was detected while serializing an object of type 'MyApp.Models.Post'I detected the error in FireFox FireBug because the AutoComplete most of the time does not work.Does anyone sees anything wrong?!Thanks,Miguel