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 7489195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:12:48+00:00 2026-05-29T15:12:48+00:00

When I created a nested hastable in wcf, I get an error which is

  • 0

When I created a nested hastable in wcf, I get an error which is “The underlying connection was closed: The connection was closed unexpectedly.”
I don’t know where is the problem.

Client code

    private static List<Playlist> remotePlaylistArray;
    private static List<Playlist> _PlaylistArray;
    public static List<Playlist> PlaylistArray
    {
        get
        {
            if (_PlaylistArray == null)
            {
                _PlaylistArray = myClient.GetPlaylists(Username, Password, (int)UserInf["id"], "%").Select(i => new Playlist
                (
                    i["name"].ToString(),
                    true,
                    ((Hashtable[])i["medias"]) == null ? null :
                    ((Hashtable[])i["medias"]).Select(ix => new YoutubeMedia()
                    {
                        Duration = ix["duration"].ToString(),
                        Title = (string)ix["title"],
                        ID = (string)ix["videoinf"]
                    }).ToArray()
                ) { ID = (int)i["id"] }).ToList();//The underlying connection was closed: The connection was closed unexpectedly.

                remotePlaylistArray = new List<Playlist>(_PlaylistArray);
            }

            return _PlaylistArray;
        }

Service Code

    public IEnumerable<Hashtable> GetPlaylistItems(string username, string password, int pid)
    {
        return this.ExecuteHashtable("GetPlaylistItems", username, Crypter.DoTwiceMD5(password), pid);
    }

    public IEnumerable<Hashtable> GetPlaylists(string username, string password, int userid, string filter)
    {
        List<Hashtable> list = this.ExecuteHashtable("GetPlaylists", username, Crypter.DoTwiceMD5(password), userid, filter).ToList();

        foreach (var item in list)
        {
            Hashtable[] arr = GetPlaylistItems(username, password, (int)item["id"]).ToArray();
            item.Add("medias", arr.Length != 0 ? arr : null);
        }

        return list;
    }

the exception comes from tracelistener is

Type ‘System.Collections.Hashtable[]’ with data contract name ‘ArrayOfArrayOfKeyValueOfanyTypeanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays&#8217; is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

  • 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-05-29T15:12:48+00:00Added an answer on May 29, 2026 at 3:12 pm

    What happens in your case is that HashTable is not directly serializable, so if it’s really necessary for you to return a HashTable you have to write a custom serializer.

    One question: does your server side know the Playlist type? If yes, I would highly recommend you to return a List instead of a HashTable …

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

Sidebar

Related Questions

I am trying to created nested dictionary variable like the below, But I get
I get following exception Instances cannot be resolved and nested lifetimes cannot be created
How do you get a specific nested control of dynamically created controls (i.e. the
I have created a nested list with drag/drop functionality. My issue is that I
because obj, the playingCard object is created inside a nested for loop does that
I followed this simple tutorial and created a nested repeater. This tutorial is simple
I have created a very simple nested loop example and am struggling to write
I am using a Singleton instance created out of a nested class. This instance
I am trying to created nested layers. I want there to be two columns
I'm sure I'm doing something really stupid, but I've created a Nested Site master

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.