自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Here is a forum for reporting failure to Arbor developer.
Please read the forum rules carefully and enter the information necessary to confirm the problem.

Note:
  • Please read the "Update Guide" carefully when updating Arbor.
  • The bugs that we already know are summarized in "Known Issues", so please check once.
  • Please check ReleaseNote and use the latest version if possible before reporting a bug.
  • Unity beta and alpha versions are not supported. Please use the official release version.
  • In principle, defects caused by the introduction of other assets are not supported. If you find a defect, please report it after isolating which asset is the problem.

ここは、Arbor開発者へ不具合を報告するためのフォーラムです。
フォーラムルールをよく読み、不具合確認に必要な情報を記載するようお願いします。

注意点:
  • Arborを更新する際は「アップデートガイド」をよく読み行ってください。
  • 既に把握している不具合は「既知の問題」にまとめてありますので一度確認してみてください。
  • 不具合報告をする前にReleaseNoteを確認し、なるべく最新バージョンを使用して下さい。
  • Unityのベータ版およびアルファ版はサポート対象外です。正式リリース版をご利用ください。
  • 他アセット導入による不具合は原則サポート対象外です。不具合を見つけた場合はどのアセットの問題であるか切り分けた上でのご報告をお願いいたします。

Forum rules
The items necessary for reporting are as follows.
  • OS(Required)
  • Unity version(Required)
  • Arbor version(Required)
  • How to reproduce(Required)
    The reproduction method should be described accurately so that anyone can read the same procedure.
    If you do not know the exact reproduction procedure, as long as you can remember it, so please tell us what you were doing immediately before and the last time you edited it.
  • Build platform
  • Reproduction project (Minimum configuration not including Arbor and other assets) or video

Note:
  • Please read the "Update Guide" carefully when updating Arbor.
  • The bugs that we already know are summarized in "Known Issues", so please check once.
  • Please check ReleaseNote and use the latest version if possible before reporting a bug.
  • Unity beta and alpha versions are not supported. Please use the official release version.
  • In principle, defects caused by the introduction of other assets are not supported. If you find a defect, please report it after isolating which asset is the problem.

報告に必要な項目は以下の通りです。
  • OS(必須)
  • Unityバージョン(必須)
  • Arborバージョン(必須)
  • 再現方法(必須)
    再現方法については、誰が読んでも同様の手順を行えるよう正確に記述するようにお願いいたします。
    もし正確な再現手順が不明な場合、覚えている限りで構いませんので直前に行っていたことや最後に編集した時のことを教えてください。
  • ビルドプラットフォーム
  • 再現プロジェクト(Arborや他アセットなどを含まない最小構成)もしくは動画

注意点:
  • Arborを更新する際は「アップデートガイド」をよく読み行ってください。
  • 既に把握している不具合は「既知の問題」にまとめてありますので一度確認してみてください。
  • 不具合報告をする前にReleaseNoteを確認し、なるべく最新バージョンを使用して下さい。
  • Unityのベータ版およびアルファ版はサポート対象外です。正式リリース版をご利用ください。
  • 他アセット導入による不具合は原則サポート対象外です。不具合を見つけた場合はどのアセットの問題であるか切り分けた上でのご報告をお願いいたします。
kudou

自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by kudou »

下記のようなクラスで testScriptableObject に自身の参照をもったときに StackOverflowException が発生するか Unity が強制終了します。

public class TestScriptableObject : ScriptableObject
{
public TestScriptableObject testScriptableObject;
}

StackOverflowException: The requested operation caused a stack overflow.
Arbor.EachField`1+FindFieldBase[Arbor.CalculatorSlot].FindField (System.Object obj, System.Reflection.FieldInfo fieldInfo) (at Assets/Plugins/Arbor/Internal/Scripts/EachField.cs:81)
Arbor.EachField`1+FindFieldBase[Arbor.CalculatorSlot].Find (System.Object obj, System.Type type) (at Assets/Plugins/Arbor/Internal/Scripts/EachField.cs:111)

また、直下のフィールドでなくても、その先のフィールドで参照をもつと発生しました。
kudou

Re: 自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by kudou »

動作環境を書くのを忘れていました。

unity 2018 1.0 f2
arbor3.1.1
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: 自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by caitsithware »

ご報告ありがとうございます。

確認して修正いたします。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: 自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by caitsithware »

確認いたしましたが、ご提供してくださった内容では再現確認できませんでした。

行った再現確認方法:
  • TestScriptableObject.cs作成

    Code: Select all

    using UnityEngine;
    using System.Collections;
    
    [CreateAssetMenu]
    public class TestScriptableObject : ScriptableObject
    {
    	public TestScriptableObject testScriptableObject;
    }
    
  • ProjectウィンドウでTestScriptableObjectアセットを作成。
  • TestScriptableObjectアセットのtestScriptableObjectフィールドに自身のオブジェクトを設定。
  • TestStackOverflowBehaviour.cs作成

    Code: Select all

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using Arbor;
    
    [AddComponentMenu("")]
    public class TestStackOverflowBehaviour : StateBehaviour {
    
    	public TestScriptableObject test;
    }
    
  • シーンにArborFSM作成。
  • ステート作成し、TestStackOverflowBehaviourをアタッチ。
  • TestStackOverflowBehaviourのtestフィールドにTestScriptableObjectアセット設定。
  • EachFieldの該当部分にDebug.Log仕込むなどしても異常は検知できず。
また、EachFieldの内容からするとUnityオブジェクトには本来付ける必要がないSystem.Serializable属性が付いている状態で自身を参照すると無限再帰するようになっておりました。
もしTestScriptableObjectにSystem.Serializableを付けている場合は削除していただくと改善されるかもしれません。
(この無限再帰になる問題は修正しておきます)

他、なにか情報がありましたら教えていただけると助かります。
kudou

Re: 自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by kudou »

>また、EachFieldの内容からするとUnityオブジェクトには本来付ける必要がないSystem.Serializable属性が付いている状態で自身を参照すると無限再帰するようになっておりました。
>もしTestScriptableObjectにSystem.Serializableを付けている場合は削除していただくと改善されるかもしれません。
>(この無限再帰になる問題は修正しておきます)

上記の件が問題だったようです。
報告に必要な情報が漏れていて、誠に申し訳ございません。
自作のScriptableObjectにSerializableがついていた個所を削除することで、この件の問題は発生しなくなりました。
迅速な対応ありがとうございました。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: 自身の参照を持つオブジェクトでStackOverflowExceptionが発生

Post by caitsithware »

ご確認ありがとうございます。
どの問題か特定できてよかったです。

無限再帰になってしまうのは緊急性の高い不具合ですので、早急に修正版を更新いたします。

また、アセットストアへの反映には数日時間がかかってしまいますので、正式な対処方法も掲載しておきます。

対処方法:
  • Assets/Plugins/Arbor/Internal/Scripts/EachField.csをスクリプトエディタで開く。
  • 79行目に以下のコードを挿入

    Code: Select all

    else if (type == typeof(Object) || type.IsSubclassOf(typeof(Object)))
    {
    	return;
    }
    
ご不便おかけして申し訳ございませんが、よろしくお願いいたします。
Locked