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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:21:50+00:00 2026-05-27T06:21:50+00:00

Okay, The post was getting way too long and contained way too much self

  • 0

Okay, The post was getting way too long and contained way too much self corrects, so I’m rewriting it from start. If you want to read back, check the changelog.

The latest revision of the code can be found here: http://pastebin.com/KMHVb5gA
I’m getting an overflow in system.XML.dll for some reason; It has no stacktrace, and it just stops execution.

I have no idea WHY it overflows, but I Do know it happens after I call Save()

            public bool save(string filename) //causes stack overflow when savenode is IEnumerable (and otherwise it does nothing).
            {
                XmlSerializer serializer = new XmlSerializer(typeof(List<savenode>));
                System.IO.FileStream fstream = new System.IO.FileStream(filename, System.IO.FileMode.OpenOrCreate);
                serializer.Serialize(fstream, innerdict);
                fstream.Flush();
                fstream.Close();
                return true;
            }

I’m completely new to making my own IEnumerable classes, so if you see something obvious wrong, please let me know!

The calling code looks like this:

        Console.WriteLine("Commencing XML persistency test");
        CedLib.Persistence.XMLPersistenceDictionary.XMLPersistenceDictionary persistence = new CedLib.Persistence.XMLPersistenceDictionary.XMLPersistenceDictionary(logger); //Works!!
        persistence.Add("test", "testvaluefennecs");
        Console.WriteLine(persistence["test"].obj);
        foreach (var snode in persistence)
        {
            Console.Write("Contents: " + snode.obj);
        }
        persistence.save("test.xml");
        persistence.load("test.xml");
        if (persistence["test"].obj != "testvaluefennecs")
        {
            logger.logerror(new Exception("XML test failed!! Expected 'testvaluefennecs', got: " + persistence["test"].obj));
        }
        else
            Console.WriteLine("XML test success!");

And the output like this:

Commencing XML persistency test
[17:54:09] info: Initialized new XMLPersistence dictionary
New node: test
[17:54:09] Notice: Adding new dictionary item: test
testvaluefennecs
Contents: testvaluefennecs
Process is terminated due to StackOverflowException.

Anyone have an idea? Any suggestion is welcome! I’m completely stuck on this!

[edit]
Just found the exact line it overflows at, it’s this:

XmlSerializer serializer = new XmlSerializer(typeof(List<savenode>));
  • 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-27T06:21:50+00:00Added an answer on May 27, 2026 at 6:21 am

    I GOT IT! A friend of mine pointed me to it, and i have to add that JonB has helped a lot too!

    The problem is that savenode was IEnumerable. I thought i needed that, but turns out i don’t!
    The reason the serializer was overflowing was because making savenode enumerable, turned List into an array of lists (which it can’t serialize!)

    The trick was simply turning savenode non-IEnumerable again, and all worked!

    Now to find other, new bugs and swat those in a shorter time span.
    Sometimes, being programmer is like playing super meat boy; You’re stuck in the same level for DAYS but when you finally nail it, you’re waking up the neighboars with your joy. (ups lol)

    New version of the code for those who are interested: http://pastebin.com/7xQUMAUn

    Current calling code, Working:

            Console.WriteLine("Commencing XML persistency test");
            CedLib.Persistence.XMLPersistenceDictionary.XMLPersistenceDictionary persistence = new CedLib.Persistence.XMLPersistenceDictionary.XMLPersistenceDictionary(logger); //Works!!
            persistence.Add("test", "testvaluefennecs");
            persistence["test"].Add("test", "fennecs");
            Console.WriteLine(persistence["test"].obj);
            foreach (var snode in persistence)
            {
                Console.Write("Contents: " + snode.obj);
                foreach (var item in snode.childnodes)
                {
                    Console.Write("Contents: " + snode.obj);
                }
            }
            Console.WriteLine("\nSaving dictionary");
            persistence.save("test.xml");
            persistence = null; Console.WriteLine("Nullified dictionary");
            persistence = new CedLib.Persistence.XMLPersistenceDictionary.XMLPersistenceDictionary();
            persistence.load("test.xml");
            Console.WriteLine("Loaded dictionary");
            if (persistence["test"].obj != "testvaluefennecs")
            {
                logger.logerror(new Exception("XML test failed!! Expected 'testvaluefennecs', got: " + persistence["test"].obj));
            }
            else
                Console.WriteLine("XML test success!");
    

    May the code be with you!

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

Sidebar

Related Questions

Okay. I've read this post, and I'm confused on how it applies to my
Okay...I'm really getting a bit frustrated with this. I know that this post will
Okay, what have I done wrong here? I'm trying to .POST data from a
Okay, so I am basically making a script to pass post data using cURL.
Okay, so I'm trying to make this bigger: Post: <input id=postbox type=text rows=6 cols=40
Okay so here is the deal. As the question states, I'm trying to POST
Okay, I think I'm just making a stupid mistake here, but I want to
okay so this is probably a soft pitch question for sombody, but I want
I have a rather complicated toolchain so prepare for a lengthy post until getting
Okay, I am not getting any response with my original wordy wordness... Can you

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.