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

  • SEARCH
  • Home
  • 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 991061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:02:47+00:00 2026-05-16T06:02:47+00:00

I built a program, and i press a button, the program crashes. Here is

  • 0

I built a program, and i press a button, the program crashes.
Here is the button’s code:

            _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema);

Debuging returned StackoverFlow(location is marked in a comment), Here is the whole code:

        private string alFile = @".\alRecord.xml";

    public DataTable alRecord;
    public DataTable _alRecord
    {
        get
        { //location of stackoverflow
            if (_alRecord == null)
            {
                alRecord = new DataTable();
                if (File.Exists(alFile))
                { _alRecord.ReadXml(alFile); }
                else
                { InitDataTable2(_alRecord); }
            }
            return _alRecord;
        }
    }

    private void InitDataTable2(DataTable table)
    {
        table.TableName = "AlTable";
        table.Columns.Add("ID", typeof(int));
        table.Columns.Add("sun", typeof(bool));
        table.Columns.Add("mon", typeof(bool));
        table.Columns.Add("tue", typeof(bool));
        table.Columns.Add("wed", typeof(bool));
        table.Columns.Add("thu", typeof(bool));
        table.Columns.Add("fri", typeof(bool));
        table.Columns.Add("sat", typeof(bool));
        table.Columns.Add("doors", typeof(string));
        table.Columns.Add("from1", typeof(DateTime));
        table.Columns.Add("to1", typeof(DateTime));
        table.Columns.Add("from2", typeof(DateTime));
        table.Columns.Add("to1", typeof(DateTime));
        for (int i = 0; i < 99; i++)
        {
            var row = alRecord.NewRow();
            row["ID"] = i;
            row["sun"] = false;
            row["mon"] = false;
            row["tue"] = false;
            row["wed"] = false;
            row["thu"] = false;
            row["fri"] = false;
            row["sat"] = false;
            row["doors"] = "";
            row["from1"] = "00:01";
            row["to1"] = "23:59";
            row["from2"] = "00:01";
            row["to2"] = "23:59";
            alRecord.Rows.Add(row);
        }
    }
    private void alSave_Click(object sender, EventArgs e)
    {
        _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema);
    }
  • 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-16T06:02:48+00:00Added an answer on May 16, 2026 at 6:02 am

    You are calling your property from inside the getter of your property:

    public DataTable _alRecord
    {
        get
        {
            if (_alRecord == null) // <= whoops
    

    That causes an infinite recursion – calling the getter of the property to see if it returns null calls the getter of the property to see if it returns null calls the getter of the property…

    @Dave makes a good point in the comments – in c# it is common to use a naming convention that your property is CasedLikeThis and the backing field (the field where the property actually stores its value is _namedLikeThis. It makes it easier to distinguish – you always know the _ means backing field, and vice versa.

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

Sidebar

Related Questions

i built a program that hooks the keyboard and when some hotkey pressed it
I built the opencl program using the commands: gcc -c -I ~/AMDAPP/include main.c -o
I wrote this small C++ program and built it(Release) #include<iostream> int main(){ std::cout<<Hello World;
I built a little installer, which installs to program files. I run the installer
When I press the Debug button in Visual Studio 2010 Express. And build this
I built this program that works with files. Since I made it for a
I once built a program in php that used very specific regular expressions to
The following C# program (built with csc hello.cs ) prints just Hello via Console!
I've built a program in C# Windows Forms, now on the first load up
This is for coursework. I've built the whole program, and it does everything right,

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.