InvalidOperationException: Operation is not valid due to the current state of the object System.Collections.Stack.Peek ()

I have a custom component which i use in Editor GUI.

It works well in case if I don’t use any layout blocs like ScrollView, HorizontalView and so on,
but if I use on of them i’m getting following exception

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Peek () (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Collections/Stack.cs:321)
UnityEngine.GUILayoutUtility.EndLayoutGroup ()
UnityEngine.GUILayout.EndHorizontal ()
UnityEditor.EditorGUILayout.EndHorizontal ()
UFTTestAtlasEntry.showAllSprites () (at Assets/Tests/Editor/UFTTestAtlasEntry.cs:37)
UFTTestAtlasEntry.OnGUI () (at Assets/Tests/Editor/UFTTestAtlasEntry.cs:27)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

here is a part of code where i’m getting this error
void OnGUI () {
showAllSprites ();
}

	void showAllSprites ()
	{
		EditorGUILayout.BeginHorizontal();	
		
		e1 = UFTEditorGUILayout.atlasEntryMetadata(atlasMetadata,e1, GetInstanceID());					
		e2 = UFTEditorGUILayout.atlasEntryMetadata(atlasMetadata,e2, GetInstanceID());			
				
		EditorGUILayout.EndHorizontal();
	}

I saw this topic Problem with ScrollView - Questions & Answers - Unity Discussions but it doesn’t work for me.

here is a source code of the whole project.

and this is UFTEditorGUILayout class which render my own object

update 1
i found problem part of code

Somwhere in UFTEditorGUILayout.atlasEntryMetadata there is initialisation of additional window.

	public static UFTSpriteChooseWindow Initialize(UFTAtlasMetadata atlasMetadata, UFTAtlasEntryMetadata atlasEntryMetadata, Vector2 parentWindowPosition, string parentControlKey){
		UFTSpriteChooseWindow window=ScriptableObject.CreateInstance<UFTSpriteChooseWindow>();
		window.atlasMetadata=atlasMetadata;
		window.atlasEntryMetadata=atlasEntryMetadata;		
		window.parentControlKey=parentControlKey;
		
		Rect position=new Rect(Event.current.mousePosition.x + parentWindowPosition.x -30,
							   parentWindowPosition.y-200,
							   250,
							   50);
		window.position=position;
		window.ShowAsDropDown(window.position,new Vector2(120,500)); //here is i'm getting System.Collections.Stack.Peek exception
		//window.Show();//  It works well
		return window;
	}

and window.Show() works well, without any exception, but window.ShowAsDropDown(…) show this exception.

I don’t know how to fix it with DropDown, but what i need is this

[8704-screen+shot+2013-03-08+at+7.38.42+pm.png|8704]

it’s just a custom combobox.

Same error for me, but i try implement my own CustomEditor.
After wasting a lot time in google and finding nothing, I begin playing around with this error, and this how i did fix it in my own code…

[CustomEditor(typeof(SomeClass))]
class SomeClassCustomEditor : UnityEditor.Editor
{
    public override void OnInspectorGUI()
    {
        var myTarget = (SomeClass)target;

        // call it with EditorApplication.delayCall +=
        if (GUILayout.Button("Some Unsafe Action"))
            EditorApplication.delayCall += myTarget.SomeUnsafeAction;

        // call it directly
        if (GUILayout.Button("Some Safe Action"))
            myTarget.SomeSafeAction();
    }
}

------------------------------------------------

class SomeClass : MonoBehaviour // of myTarget
{
#if UNITY_EDITOR
    public void SomeUnsafeAction()
    {
        ...some code, leads to triggering that ERROR
    }
    public void SomeSafeAction()
    {
        ...some safe code, NOT triggering that ERROR
    }
#endif
}