Invoking a file dialogue from a PropertyDrawer

When invoking EditorUtility.OpenFilePanel from within PropertyDrawer.OnGUI my editor hits an error:
InvalidOperationException: Stack empty.

Here is the propertydrawer code:

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
	EditorGUI.BeginProperty(position, label, property);
	{
		GUILayout.BeginHorizontal();
		{
			GUILayout.Label(property.displayName);
			SerializedProperty stringGuidProperty = property.FindPropertyRelative("StringGuid");
			EditorGUILayout.SelectableLabel(stringGuidProperty.stringValue);

			// Select a file via a file browser and read the SerialID from that file
			if (GUILayout.Button("Copy Instance ID From File"))
			{
				string path = EditorUtility.OpenFilePanel("Select Instance to Load", "", "xml");
				if (path.Length != 0)
				{
					string id = DataSerializer.GetSerialIDFromFile(path);
					stringGuidProperty.stringValue = id;
				}
            }
        }
		GUILayout.EndHorizontal();
	}
	EditorGUI.EndProperty();
}

While debugging this everything seems to work. The correct ID is assigned to the stringGuidProperty except when GUILayout.EndHorizontal() is executed an error is thrown which seems to prevent the property from being applied.

If I change the line opening the file panel to a hardcoded string everything works fine without any errors and the correct ID is loaded.

Here is the full error:

InvalidOperationException: Stack empty.
System.Collections.Generic.Stack`1[T].ThrowForEmptyStack () (at <0463b2ef957545c0a51b42f372cd4fbb>:0)
System.Collections.Generic.Stack`1[T].Pop () (at <0463b2ef957545c0a51b42f372cd4fbb>:0)
UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <bbfbd5a71eea45d1a1354233c800516b>:0)

It is possible that the GUILayout.Horizontal sections are messing with the file utility - have you tried moving the actual call to EditorUtility.OpenFilePanel to the outer scope?

 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     EditorGUI.BeginProperty(position, label, property);
     {
         SerializedProperty stringGuidProperty = property.FindPropertyRelative("StringGuid");
         bool openFile = false;

         GUILayout.BeginHorizontal();
         {
             GUILayout.Label(property.displayName);
             EditorGUILayout.SelectableLabel(stringGuidProperty.stringValue);
 
             // Cache the button press
             openFile = GUILayout.Button("Copy Instance ID From File");
         }
         GUILayout.EndHorizontal();

         // Select a file via a file browser and read the SerialID from that file
         if (openFile)
         {
             string path = EditorUtility.OpenFilePanel("Select Instance to Load", "", "xml");
             if (path.Length != 0)
             {
                 string id = DataSerializer.GetSerialIDFromFile(path);
                 stringGuidProperty.stringValue = id;
             }
         }
     }
     EditorGUI.EndProperty();
 }