Question Debugging

AccessShell

Member
Joined
Jun 14, 2016
Messages
21
Programming Experience
10+
When I used to write in VB6 I was able to debug with breakpoints. I would stop at a breakpoint, set the next statement to somewhere before the current line, make some code changes and continue from that new point. I can't seem to do this in VB.net. Am I missing something, or is that the way VB.net workk?

Thanks
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,100
Location
Sydney, Australia
Programming Experience
10+
There are some limitations on Edit & Continue, although I'm not 100% sure what they are and whether they have changed recently. If I remember correctly, it was not originally possible in 64-bit apps, although that may not be the case any more, as 64-bit apps have become the norm. I'll do a little testing and see what I can see. What actually happened when you tried? Did you get an error message of some sort or were you just not able to implement one of the steps?
 

AccessShell

Member
Joined
Jun 14, 2016
Messages
21
Programming Experience
10+
I got a pop up box with options. Option 1: Restart the program. Option 2: Continue without the changes.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,100
Location
Sydney, Australia
Programming Experience
10+
I just tried it without issue targeting Any CPU with Prefer 32-bit checked and unchecked in both VS 2017 and VS 2019. The code I used was simple, so maybe you were using something more complex that didn't support it. I used this:
VB.NET:
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim x = 10
        Dim y = 10
        Dim z = x * y

        MessageBox.Show(z.ToString())
    End Sub
End Class
with a breakpoint on the highlighted line. I kept changing the value of y and dragging the current line marker back to the declaration of x and it worked as expected.
 

AccessShell

Member
Joined
Jun 14, 2016
Messages
21
Programming Experience
10+
OK. I am using a much older version
4455

Also, here is the popup
4456
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,100
Location
Sydney, Australia
Programming Experience
10+
I would recommend that you not use VS.NET 2003 and install VS 2019, which you can get for free (Community Edition). Virtually no one uses anything older than VS 2010 these days and not many use that even. I don;t know what it does or doesn't support and couldn't get a copy to install to test. Many, MANY improvements have been made in the IDE, language and Framework since then.
 

AccessShell

Member
Joined
Jun 14, 2016
Messages
21
Programming Experience
10+
Ok, I will do that. Why is it free.? Can I transfer my projects over to VS 2019 from the one I have?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,100
Location
Sydney, Australia
Programming Experience
10+
Why is it free.?
In 2005, Microsoft started creating free Express editions of VS targeted at primarily hobbyists. These were quite limited with one aimed at Windows development in VB, one at Windows and C# and one at ASP.NET in VB or C#. I don;t know how successful they were but I can only assume that Microsoft decided that they weren't encouraging enough people to take the step to paying for VS Pro and they may have been losing developers to other tools. VS 2010 was the last version to have Express editions and Community arrived with 2012 or 2013 (can't recall which), providing most of the features of VS Pro in one free package. Just enjoy it and be thankful. :cool:
Can I transfer my projects over to VS 2019 from the one I have?
Yes, although there may be some massaging to do. Generally speaking, anything supported in an old version will be supported in a newer version, even if there may be better ways to do things now. One thing you will notice is that, since 2005 and the introduction of partial classes, the designer code is separated from the user code in Windows Forms, whereas your project will have the designer code inside a region in the same file as the user code. I would assume that the VS 2019 designer should be able to recognise the location of the InitializeComponent method and continue putting the designer code in the right place. Any new forms will presumably be split over two code files though.
 
Top Bottom