标签: stack-overflow

0
推荐指数
2
解决办法
736
查看次数

私有属性字段上的StackOverflow异常

有人可以告诉我为什么我会得到StackOverflowException下面的代码?

    private float _voltageRange
    {
        get { return _voltageRange + ((10F/100F)*_voltageRange); }
        set { _voltageRange = value; }
    }
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?是不是编译器会自动生成支持字段?

我想要实现的目标是回归_VoltageRange10%.

c# stack-overflow properties

0
推荐指数
1
解决办法
113
查看次数

得到堆栈溢出错误,我不确定为什么

编辑:

主要方法......

创造一个新的球员.

球员班......

创建一个手的实例.

手班......

创造一个arraylist

就这样.它非常简单

public class Player 
{
/*------------------------
 * instantiating variable
 -----------------------*/
protected Hand hand;
protected boolean active = false;

/*------------
 * constructor
 -----------*/
    public Player()
{
    hand = new Hand();
    hand.setSize(5);
}



public class Hand extends Player
    {
/*-----------------------------------------
 * variable declaration
 ----------------------------------------*/
ArrayList <Card> hand;
protected int size;
Card temp;

     /*------------------------------------------
 * constructor
 * creates arraylist of cards to keep in hand
 ------------------------------------------*/
public Hand()
{
    hand = new ArrayList<Card>();
}

/*-------------------------------
 * …
Run Code Online (Sandbox Code Playgroud)

java stack-overflow

0
推荐指数
1
解决办法
65
查看次数

大输入的堆栈溢出

所以这是我计划的一部分。当我为差值超过 250000 的数字调用 bound 时,它会导致堆栈溢出.. 我该如何解决这个问题?该程序适用于较小的输入。我很确定程序的其余部分都很好。有没有办法重写函数以便它们工作?我宁愿不使用 for while 循环。谢谢

let rec sqdigits a =
if a = 0 then 0
else ( a mod 10)*( a mod 10) + sqdigits (a/10);;

let rec bound c d =
if c>d then []
else (sqdigits (c))::(bound (c+1) d);;
Run Code Online (Sandbox Code Playgroud)

stack-overflow stack ocaml ml overflow

0
推荐指数
1
解决办法
84
查看次数

任何人都可以找出这个StackOverflowException的原因吗?

试图学习编程并再次失去信心,因为我认为我已经内化了一个简单的概念,但看起来非常特殊的东西正在发生,或者它只是飞过我的头脑.

当我运行程序时,如果通过为FirstName或SecondName分配字符串来访问该属性,则会出现StackOverFlowException

我的客户类别:

class Customer : ICustomer
{
    public string FirstName
    {
        get
        {
            return FirstName;
        }

        set
        {
            FirstName = value;
        }
    }

    public string fName
    {
        get
        {
            return fName;
        }

        set
        {
            fName = value;
        }
    }

    public string SecondName
    {
        get
        {
            return SecondName;
        }

        set
        {
            SecondName = value;
        }
    }

    public string sName
    {
        get
        {
            return sName;
        }

        set
        {
            sName = value;
        }
    }

    public int ID
    {
        get
        {
            return ID; …
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow

0
推荐指数
1
解决办法
105
查看次数

只有两个嵌套布局的 StackOverFlowError

我收到 StackOverFlowError。我有动态添加按钮的相对布局和表格布局。谁能帮我这个?这是我的代码:

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    populateButtons();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml. …
Run Code Online (Sandbox Code Playgroud)

stack-overflow android android-tablelayout

0
推荐指数
1
解决办法
455
查看次数

在表单之间切换时出现System.StackOverflowException

我正在尝试为我正在开发的游戏创建一个菜单.这是源代码:

   using System;
   using System.Collections.Generic;
   using System.ComponentModel;
   using System.Data;
   using System.Drawing;
   using System.Linq;
   using System.Text;
   using System.Threading.Tasks;
   using System.Windows.Forms;

namespace Racing_Manager
{

public partial class Form1 : Form
{
    Form1 form1 = new Form1();
    public Form1()
    {
        InitializeComponent();

    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    //Exit Button
    private void button1_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }
    //Help Button
    private void Help_Click(object sender, EventArgs e)
    {

    }

    //Play Button
    private void Play_Click(object sender, EventArgs e)
    {
        Hide();
        Form2 secondMenu …
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow

0
推荐指数
1
解决办法
803
查看次数

Swift递归闭包堆栈溢出bug

更新:应该注意的是,下面的问题是学术性质和核心位置的使用,或者位置数据的轮询与问题无关 - 执行此操作的正确方法始终是通过核心位置委托方法.我最初的问题最终归结为:"swift中是否有无限递归?(或尾递归)".答案是否定的.这是由于堆栈空间耗尽导致我的错误的原因.

原始问题:我遇到了一个通过闭包传递值的递归函数的问题.我是一个长期的Objective-C开发人员,但是没有在Swift编程很长时间,所以也许我错过了一些明显的东西.这是函数以及我如何调用它:

public func getLocation(completion: @escaping (CLLocationCoordinate2D?) -> ())
{
    completion(self.currentLocation)
    weak var weakSelf = self
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
        weakSelf?.getLocation(completion: {location in
            completion(weakSelf?.currentLocation)
        })
    }
}

LocationManager.shared.getLocation(completion: {location in
        if(location != nil)
        {
            weakSelf?.lonLabel.text = "Lat: " + location!.latitude.description
            weakSelf?.latLabel.text = "Lon: " + location!.longitude.description
        }
    })
Run Code Online (Sandbox Code Playgroud)

Thread 1: EXC_BAD_ACCESS (code=2, address=0x16f1b7fd0)运行一段时间后我得到的错误(描述)是这样的:

在此输入图像描述

我想要完成的是将自动更新位置值传递给位置管理器对象.我正在考虑另一种方法,performSelector withObject afterDelay但在这一点上,我只是想知道为什么会崩溃?

stack-overflow recursion closures swift

0
推荐指数
1
解决办法
524
查看次数

在 C# 中遍历对象属性

我有一个客户类型对象列表,当我遍历该列表时,我希望能够遍历每个客户的属性。然后我想将该属性值打印为字符串。我收到 StackOverFlowException 错误。

让我先说:

  1. 这只是一个类库,我从其他地方调用该函数并且调用有效。
  2. 对数据库的调用及其返回的信息是正确的(我在尝试遍历属性之前对其进行了测试)
  3. 我的最终目标是将客户列表转换为二维数组,其中每列代表一个客户,每行代表客户属性。

提前致谢!

    using Dapper;
    using System;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Xml.Linq;
    using System.Reflection.Emit;
    using System.Reflection;
    using System.Collections;

    namespace AtoCLib
    {
        public class DataAccessLayer
        {
            public static List<Customer> GetCustomerList(string startChar)
            {
                string sql = $"SELECT TOP (10) P.LastName, [CustomerID],[PersonID] ,[StoreID] ,[TerritoryID] ,[AccountNumber] FROM [AdventureWorks2017].[Sales].[Customer] C INNER JOIN [Person].[Person] P ON C.CustomerID = P.BusinessEntityID WHERE P.LastName >= '{startChar}'";
                List<Customer> CustomerList = new List<Customer>();

                try
                {
                    using (var connection = new SqlConnection("Data Source=SHCP-2035;Initial Catalog=AdventureWorks2017;Integrated Security=True"))
                    { …
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow ienumerable ienumerator properties

0
推荐指数
2
解决办法
2万
查看次数

堆栈缓冲区溢出、堆栈下溢和堆栈溢出之间有什么区别?

今天我们数据结构的老师在学习栈的时候提到了这一点,但是没有给出正确的解释。

stack-overflow programming-languages buffer-overflow data-structures

0
推荐指数
1
解决办法
2584
查看次数