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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:33:52+00:00 2026-05-23T16:33:52+00:00

I get a stack overflow error from the last line of the below code.

  • 0

I get a stack overflow error from the last line of the below code. I cant see why. Any ideas?

        var slots = from a in db.AvailableAppointments
                    where a.RequestID == reqId
                    select new
                    DataLayer.DateAndTimeslot
                    {
                        date = a.Date.ToShortDateString(),
                        timeSlot = a.Timeslot
                    };

        returnValue.DateAndTimeslot = slots.ToArray();

My class;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace DataLayer
{
    [DataContract(Namespace = "http://wholesale.fluidata.co.uk/bt/AppointmentAvailabilityResponse")]

    public class AppointmentAvailabilityResponse : DataLayer.WebserviceMessage
    {
        DateAndTimeslot[] _dateAndTimeSlot;

        [DataMember]
        public DateAndTimeslot[] DateAndTimeslot
        {
            get { return _dateAndTimeSlot; }
            set { _dateAndTimeSlot = value; }
        }

    }

    public class DateAndTimeslot
    {
        private String _date;
        private String _timeSlot;

        [DataMember]
        public string date 
        {
            get { return this._date; }
            set {_date = value;}
        }

        [DataMember]
        public string timeSlot
        {
            get { return this.timeSlot; }
            set {_timeSlot = value;}
        }

    }
}

My table (With example data)

ID  RequestID   Date            Timeslot
171 3214    2005-12-28 00:00:00.000 EV
172 3214    2005-12-28 00:00:00.000 EV
173 3214    2005-12-29 00:00:00.000 EV
174 3214    2005-12-29 00:00:00.000 EV
175 3214    2005-12-30 00:00:00.000 EV
176 3214    2005-12-30 00:00:00.000 EV


CREATE TABLE [dbo].[AvailableAppointments](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [RequestID] [int] NOT NULL,
    [Date] [datetime] NOT NULL,
    [Timeslot] [varchar](21) NOT NULL,
 CONSTRAINT [PK_AvalibleAppointments] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
  • 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-23T16:33:53+00:00Added an answer on May 23, 2026 at 4:33 pm

    Here:

    [DataMember]
    public string timeSlot
    {
        get { return this.timeSlot; }
        set { _timeSlot = value; }
    }
    

    Notice the missing _ in the getter and the recursive call?

    Should be:

    [DataMember]
    public string timeSlot
    {
        get { return this._timeSlot; }
        set { _timeSlot = value; }
    }
    

    And by the way since I started to use Auto implemented properties in C# those kind of errors went into oblivion:

    [DataMember]
    public string TimeSlot { get; set; }
    

    Just a nitpicking side note: it is good coding practice to have property names start with a capital letter (TimeSlot instead of timeSlot).

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

Sidebar

Related Questions

I need to get a stack frame of a function from any PDB (All
I'm using this code, and I get the stack trace that is listed below.
Dear Stack Overflow Community, I'm attempting to get the date from a datepicker and
Running the following code, I get a StackOverflowError at the getPackage() line. How can
When you get a badge or aren't logged in to stack overflow there's a
I had posted this earlier on Stack Overflow, but couldn't get a positive result.
I get an InvalidOperationException on this line of code: SynchronizedInvoke(this, () => this.Opacity =
Ok fixed jQuery code with help of others on stack overflow $(document).ready(function() { $(.note).live('click',function()
From research on Stack Overflow and other sites I'm 99% sure that the problem
I'm having a stack overflow error relating to android dialogs. I have around 21

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.