Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8814395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:06:43+00:00 2026-06-14T04:06:43+00:00

Is there an issue with returning a List(Of CustomClass) inside a DataContract()? For some

  • 0

Is there an issue with returning a List(Of CustomClass) inside a DataContract()? For some reason, I am randomly getting my WCF connection closed and I think it’s possibly due to Serialization but I’m not sure how to go about correcting it? The problem does not occur if I do not try to return a List(Of CustomClass).

To give you a better idea of what’s going on, I’m trying to pass information about a page to a WCF service. Like a search crawler… Page Title, Content, Links, etc. The List(Of CustomClass) is a list of Links. The CustomClass just holds the links information… Anchor, URL, Is it an Image, etc…

What I was trying to do is pass one class that encapsulated the page’s information and a List(Of CustomClass) which represented the links infromation.

Something like:

<OperationContract()>
Public Function Add_Page(Byval Pages as List(Of PageInfo)) as Integer 

<DataContract()>
Public Class PageInfo
    <DataMember()>
    Public Page_Title as string

    <DataMember()>
    Public Page_Links as List(Of Links)
End Class

<DataContract()>
Public Class Links
    <DataMember()>
    Public Anchor as string

    <DataMember()>
    Public URL as string
End Class

It works half the time but for some reason it will give me a generic “The underlying connection was closed: The connection was closed unexpectedly.” without any Trace information Server-Side the other half of the time. I’ve got the MaxItemsInGraph maxed out, along with the other settings, so that shouldn’t be the cause. It’s weird it works sometimes and not others. The only way I can rid this error is by removing the List(Of Links) from the example above.

I’m in the process of rewriting the code to see if it works by passing the List(Of Links) through the OperationContract, kinda like:

<OperationContract()>
Public Function Add_Page(Byval Pages as List(Of PageInfo), Byval Page_Links as List(Of Links)) as Integer 

Which I have a feeling will work fine as I have several other functions that work in a similar fashion without problem. Something tells me I am doing something wrong though, not serializing correctly or ??? Is this possible to do or is my second example what I will have to resort to using? Thanks

Edit #1 (Did not work)

The DataMember(EmitDefaultValue:=True) suggested in the Comment didn’t fix the problem so I wrote client-side code to double check there was no Nulls/Empty values being sent (this was done server-side before saving to DB)… Didn’t seem to fix the problem either. Then I realized I was Removing duplicates from the List before sending, after I checked for Nulls/Empty values.

I removed the code that checked for duplicates and now it seems to be working… I’m not sure why, the Remove Dupe code assigned a New List, after it was uniquely populated to a List(Of Links). I’m wondering if it some how was leaving Nulled values after removing Duplicates/reassigning the new list over the old. I’m going to test this a little more, if I don’t have any more issues, I’ll mark your response as the answer as I believe you are correct in assuming a nulled value was jacking the transfer up..
… After more testing, this did not fix the problem. In the process of narrowing things down. Will report back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:06:45+00:00Added an answer on June 14, 2026 at 4:06 am

    I received this error as well. I believe it had to do with me returning back a null value with the list of records being returned. I change this in the my DataMember attribute to be: [DataMember(EmitDefaultValue = true)] but I also did a check for null values because I didn’t want them returned in my query. You may, but look at the data that is being returned, if there is null values in it, do a check to not send those records through and see if that works.

    Edit: my brackets were because I did this in c# so you just have to conver it to VB.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is issue, when Uploadify plugin desn't POST more than 1 parameter. Tried 3
Is there an issue with IIS or ASP Classic where Request.ServerVariables(QUERY_STRING) returns blank if
There is an issue that I cannot solve, I've been looking a lot in
i just wondering is there any performance issue or anything thing wrong if that
I've got a duplicate content issue where there's two instances of my site indexed
I have used the cURL solution to solve XSS but there is an issue
There seems to be an issue simulating the backspace key with java.awt.Robot . This
There is a well known issue when it comes to using .NET value types
There are nice SO question and answers about this issue, but these options didn't
Hi there I am having an issue in JSP where I wish to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.