0

When I use the debugger and F5 to follow along what is currently being called in my app, I have some functions which I don't want the debugger to go through.

These functions are not important to me, and I know what they are doing. Having the debugger step through each line of this function is just taking my time.

How could I make it so that the debugger ignores the function?

Thank you!

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • If you are using the old VB6 shortcuts, F8 steps into and Shift+F8 steps over. However in both the old and new shortcuts, F5 executes everything without stopping, except at breakpoints. – GSerg Jun 20 '22 at 13:32
  • 3
    [DebuggerStepThrough Attribute - How to also skip child Methods](https://stackoverflow.com/a/53990683/7444103) – Jimi Jun 20 '22 at 13:40
  • f8 steps to the next line shift-F8 runs the sub, skips debug of that routine, and your on the next line. So, shift-F8 should work for you. – Albert D. Kallal Jun 20 '22 at 22:58

1 Answers1

2

With the help of @Jimi, I found a VB.net solution.

One has to add

<DebuggerStepThrough()>

over the first line of the function.

For example:

<DebuggerStepThrough()>
Public Function StrLen(ByVal uString As String) As Integer

    If (Not uString Is Nothing) AndAlso (Not uString = String.Empty) Then
        Return uString.Length
    Else
        Return 0
    End If

End Function
tmighty
  • 10,734
  • 21
  • 104
  • 218
  • 4
    Side note: you can simplify your function slightly with this: `If Not String.IsNullOrEmpty(uString) Then` – HardCode Jun 20 '22 at 14:42
  • Glad to see your problem solved, you can click '✔' to mark it as the accepted answer to change its status to Answered. It will also help others to solve the similar issue. – Jiachen Li-MSFT Jun 23 '22 at 08:10