Search code examples
vb.netdebuggingprogram-entry-pointbreakpoints

How to debug/breakpoint Sub Main()?


I am debugging someone else's software and it doesn't look like the code within Sub Main() is getting hit.

How can I check that the code in main() is actually running?

Main():

Sub Main()
        ‘some code
End Sub

Solution

  • Based on your comments, first get sure that you have set Sub Main as the startup object. To do this:

    1. Right click on your project
    2. Select Properties
    3. On the left panel select the first item Application
    4. On the right panel you see a dropbox with the label Startup objects:
    5. Select Sub Main

    After that your Sub Main will be called and should be also debuggable.