Mark Williams 14 Posted June 21, 2019 Occasionally, when I am debugging a particular app, if there is a bug in a section of code, the debugger opens one of my units (always the same one and which wasn't previously open or changed) and reports a bug in a specific line in that unit. The report is wrong there is no bug. If I comment out the supposedly offending line in this unit and recompile I am taken to the correct bug. After I correct that, I can then go back to the incorrectly identified line uncomment and recompile successfully. Does anyone know why I am seeing this behaviour? I am using 10.3.1, but the issue was present at least as far back as 10.2 Share this post Link to post
Stefan Glienke 2002 Posted June 21, 2019 When you say bug you obviously mean exception because the debugger does not detect bugs but exceptions and breaks if they occur. Now if the debugger stops at a wrong line it could be because you have incorrect(*) line endings in your file. (*) for the Delphi IDE/debugger any line break that is not the standard windows line ending (CRLF) confuses it and causes all kinds of wrong behavior, from stopping at wrong lines to messing up units when using code completion. Open your unit in an editor that can show line endings and even convert them (personally I use notepad++ for that but there are obviously other editors that can do that as well). Now if that is not the cause for the debugger breaking at the wrong location it can still be the debugger or the compiler that produces the debug symbols the debugger uses has a bug. Share this post Link to post
Mark Williams 14 Posted June 22, 2019 Yes. Sorry. Of course I meant exception. Thanks for the info. Will try that out and see if it is the problem. Share this post Link to post