Method debugging confusing

When I run the debugger, I get errors that are based on the code saved prior to the latest changes, but the line number that caused the error displays the latest code I typed, making it very confusing. I realized I had to close the method and reopen to cause the latest code to run.

are you saying that you have changed code (not yet saved) and then when an error happens you see the line number of the prefious saved code? This can’t be helped.

If you close the method do you then save it?
Because you don’t need to close it but save it to let the latest code run. Do you say that this isn’t the case somehow? Can you tell me how you get that state?