Dave Novo 51 Posted January 26, 2023 Hello All. If I create the following simple console application program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.Classes, System.SysUtils, System.IOUtils; var combinedPath:string; curPath:string; begin try combinedPath := TPath.Combine(ParamStr(0),'..\..\..\'); curPath:=TPath.GetFullPath(combinedPath); var f:=TFileStream.Create(curPath+'file.txt',fmCreate); f.free; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. everything works fine. I hover the mouse over the string variables and it pulls up the values, and I can view them in the watch list. However, if I make this slight change to use the new Delphi language features program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.Classes, System.SysUtils, System.IOUtils; begin try var combinedPath := TPath.Combine(ParamStr(0),'..\..\..\'); var curPath:=TPath.GetFullPath(combinedPath); var f:=TFileStream.Create(curPath+'file.txt',fmCreate); f.free; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. then when I hover the mouse over combinedPath, or curPath, nothing happens. If I enter them into the watch list I get Is there any way around this behavior. I like this new language feature, but if I cannot debug my variables then it is not very helpful. Share this post Link to post
Stefan Glienke 2002 Posted January 26, 2023 18 minutes ago, Dave Novo said: Is there any way around this behavior No, just pray the issue gets fixed in your lifetime 1 1 Share this post Link to post
Sherlock 663 Posted January 27, 2023 Is this still the case when you declare the type as well? var combinedPath: string := TPath.Combine(ParamStr(0),'..\..\..\'); var curPath:string :=TPath.GetFullPath(combinedPath); Share this post Link to post
Stefan Glienke 2002 Posted January 27, 2023 (edited) The problem within the global begin/end block is special - usually, inline variables are shown in the debugger but with the limitation that the compiler does not emit so-called live-range data for them which the debugger can use to know the locations they are valid for. For example having two nested variables of the same name causes issues with properly inspecting them because the debugger always shows the value of the first (which causes wrong data to be shown) which also has been reported multiple times. Edited January 27, 2023 by Stefan Glienke Share this post Link to post
Dave Novo 51 Posted January 27, 2023 I see, so this is just a problem because I am in the global begin..end block of a console application? Share this post Link to post
Dave Novo 51 Posted January 27, 2023 On 1/26/2023 at 12:08 PM, Stefan Glienke said: No, just pray the issue gets fixed in your lifetime Now I finally have an excuse to live a long and healthy life 🙂 1 1 Share this post Link to post
Dave Novo 51 Posted February 2, 2023 For reference, I added this bug report https://quality.embarcadero.com/browse/RSP-40502 Share this post Link to post