What do the line numbers in the stack trace mean?

Product: PowerShell Universal
Version: 2.5.2

I have a dashboard that creates a new user. It works fine, but gives these errors every time you run it

Jan 10, 2022 3:06 PM An error occurred: Cannot find an object with identity: 'USERNAME' under: 'DC=domain,DC=local'.
Endpoint: facb8f20-f377-4d3d-81f2-6cadec5a66f6
Session: 399c84d4-7ca4-4771-963a-d0f013f94c9d
File: 
Endpoint Start Line: 77
Endpoint End Line: 547
Stack Trace: at <ScriptBlock>, <No file>: line 389


Jan 10, 2022 3:06 PM An error occurred: The term 'SilentlyContinue' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Endpoint: facb8f20-f377-4d3d-81f2-6cadec5a66f6
Session: 399c84d4-7ca4-4771-963a-d0f013f94c9d
File: 
Endpoint Start Line: 77
Endpoint End Line: 547
Stack Trace: at <ScriptBlock>, <No file>: line 374

I’ve checked lines 374 and 389 and neither of them match up to any command that would throw the error.

1 Like

I have actually been wondering this myself. I’m working on a project right now where I have a couple of dashboard errors but I can’t for the life of me figure out where the heck they’re coming from. The line numbers seem arbitrary. I assume it’s due to the way the software processes the dashboards, but it’s still proven to be unhelpful. I’m mostly looking at adding my own logging at this point to close the gap.

The lines don’t match up since we build script blocks on the fly. This logging always sucked. In v2.7, we’ve improved this so the line numbers and stack trace actually make sense.

You can see below that the line number is listed properly for the stack trace.

2 Likes

You’ve got my attention! I welcome this change - it would help me figure out some weirdness in a dashboard I’m currently building.

I even have issues tracking stuff down like this. The stack trace should also be helpful as it tracks nested endpoints. In my example above the exception was thrown 4 endpoints deep so it would be hard to find usually.

I have a feeling we might run into issues with lines numbers since we have do some weird calculations to figure out the correct one but hopefully it’s close.

1 Like

Honestly though, even if it is just the line number within the endpoint (and which part of the endpoint if it has multiple parts, like where a form has the Content and the OnSubmit pieces) that’s leaps and bounds better than guessing.

A form is actually where I’m running into issues right now, and I can’t figure out where. So I’m systematically adding more and more logging and try catch blocks, hoping I’ll figure it out.

1 Like