Getting just the Main Stack

When I encounter an error in the Xojo IDE, there is a “Stack” window that displays just the stack within my Xojo application.

E.g. if I have a Window called “frmMain” and a button called cmdTestStack and pressing that calls a procedure called “FirstLevelProcedure” I see in the stack window:
frmMain.FirstLevelProcedure
frmMain.cmdTestStack.Pressed

However, if an error is raised in my FirstLevelProcedure, the RunTimeException.Stack contains a huge array of items which the documentation says includes the framework method calls.

How do I just get the application method calls as per the stack window?

Known 64 bit issue on Windows, build 32 bit.
Ticket floating around somewhere but I’m in no condition to go find it.

This one is biting me too:

Stack trace no longer complete in modal dialog exceptions

Try this workaround until the issue is fixed:

Dim Method As String
Dim Methods() As String
Dim ThisName As String
    
' Get the call stack into an array
Dim s() As StackFrame = Err.StackFrames
Dim n As Integer

' Loop through the array adding method names to the array as appropriate
For i As Integer = 0 To s.Ubound
  
  ' Add on an empty string so that the "Left" checks won't through an OutOfBoundsException. Not sure this is needed anymore.
  ThisName = s(i).Name + "                           "
  
  'Ignore the Xojo items in the Stack. This yields just the routines in the stack which is what we want.
  If ThisName.Trim <> "" And _
	ThisName.Trim <> "Main" And _
	ThisName.Left(1) <> "_" And _
	ThisName.Left(3) <> "Web" And _
	ThisName.Left(8) <> "Delegate" And _
	ThisName.Left(9) <> "RealBASIC" And _
	ThisName.Left(10) <> "AddHandler" And _
	ThisName.Left(11) <> "Application" Then
	
	' Get rid of the nonsense that Xojo puts on the end
	n = instr(Method, "%") 
	If n > 1 Then
	  Method = Left(Method, n - 1)
	End If
	
	' Add this method to the array
	Methods.Append Method 
	
  End If
  
Next

' Return the array
Return Methods