System.debuglog(error.stack(i)) triggers Too Many arguments

I am hunting an error that manifests only when an app is packed as UWP to go into the Windows Store.

I am trying to get name of the method where the exception occurs in a 2016R3 app.

This triggers at compile : “Too Many arguments: got 1, expected only 0.”.

[code]Function UnhandledException(error As RuntimeException) Handles UnhandledException as Boolean
System.debuglog("error.Message: " + error.Message)
System.debuglog("Reason: " + error.Reason)
System.debuglog(“Stack ubound: " + str(error.stack.Ubound))
for i as integer = 0 to error.Stack.Ubound-1
dim s as string = error.stack(i) // Here is the too many arguments
System.debuglog(“Stack N°” + str(i) +”: " +s)
next

End Function
[/code]

I read the LR several times. error.stack() is supposed to be a string array. I can even get the ubound.

At this point I have to confess being lost.

Any help will be deeply appreciated.

Thanks In Advance :slight_smile:

[code]Function UnhandledException(error As RuntimeException) Handles UnhandledException as Boolean
System.debuglog("error.Message: " + error.Message)
System.debuglog("Reason: " + error.Reason)

Dim stack() as string = error.stack
for i as integer = 0 to Stack.Ubound-1
dim s as string = stack(i) // No more error
System.debuglog(“Stack N°” + str(i) +": " +s)
next

End Function
[/code]

It wants conversion somehow to a string array out of my memory. Not sure why.

Thanks, Derk. It works now.

Much appreciated :slight_smile:

We have the same problem with plugin.
Stack is a function to return the array.
But you can’t use it immediately. You have to put it in temp variable.
Alternative we can add a “name(index as integer) as string” function for our arrays in addition to “name as String()”.

This is my traceback method. It writes to my own log file.

[code]sub traceback (error as RuntimeException)

Var msg as String, i, num as Integer, errStack() As StackFrame

errStack = error.StackFrames ()
num = errStack.LastRowIndex

msg = " Stack: " + errStack(0).Name
writeLog (msg, “FATAL”, “”, true)

for i=1 to num
msg = " " + errStack(i).Name
writeLog (msg, “FATAL”, “”, true)
next

end sub[/code]