How to view the value of a PRIVATE variable in debugger?
- kevclark64
- Posts: 127
- Joined: Thu Aug 15, 2019 7:30 pm
- Location: USA
How to view the value of a PRIVATE variable in debugger?
A variable which is created with PRIVATE or DIMENSION isn't available in Locals and it does not appear capable of being added to the Watch window since it says it does not exist in the current context. Some time ago there was an article posted on this site saying that PRIVATE variable values could be viewed using XSharp.MemVar.Privates in the watch window. That does not seem to work anymore, so I'm wondering if there is an alternative way to view PRIVATE variables.
How to view the value of a PRIVATE variable in debugger?
Hi Kevin,
There's a new functionality for that, you need to add a reference to the assembly XSharp.RT.Debugger, and then while debugging you can enter in the Immediate Window:
XSharp.RT.Debugger.Functions.DbgShowMemvars()
This will open a window showing all memory variables. In a future build, this functionality will be added also as a simple menu command.
Btw, there are a few more similar debug windows that can be opened in a similar way:
XSharp.RT.Debugger.Functions.DbgShowWorkAreas() // show info about all open dbfs
XSharp.RT.Debugger.Functions.DbgShowGlobals() // GLOBALs
XSharp.RT.Debugger.Functions.DbgShowSettings() // Show all SET* settings
Edit: Oh I see that the reference does not automatically get linked in just by referencing it, we need to make sure this happens in the future. For now, please add this somewhere in your Start() function, in order to be able to use those Immediate window commands:
.
There's a new functionality for that, you need to add a reference to the assembly XSharp.RT.Debugger, and then while debugging you can enter in the Immediate Window:
XSharp.RT.Debugger.Functions.DbgShowMemvars()
This will open a window showing all memory variables. In a future build, this functionality will be added also as a simple menu command.
Btw, there are a few more similar debug windows that can be opened in a similar way:
XSharp.RT.Debugger.Functions.DbgShowWorkAreas() // show info about all open dbfs
XSharp.RT.Debugger.Functions.DbgShowGlobals() // GLOBALs
XSharp.RT.Debugger.Functions.DbgShowSettings() // Show all SET* settings
Edit: Oh I see that the reference does not automatically get linked in just by referencing it, we need to make sure this happens in the future. For now, please add this somewhere in your Start() function, in order to be able to use those Immediate window commands:
Code: Select all
VAR dummy := XSharp.Debugger.GlobalsWindow{}
dummy := NULL
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
How to view the value of a PRIVATE variable in debugger?
Kevin,
You can also add the expression
to the watch window.
If you are not sure if the variable exists you can try
This will return NIL if the variable does not exist.
Robert
You can also add the expression
Code: Select all
XSharp.RT.Functions.MemVarGet("MYVARNAME")
to the watch window.
If you are not sure if the variable exists you can try
Code: Select all
XSharp.RT.Functions.__MemVarGetSafe("MYVARNAME")
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
- kevclark64
- Posts: 127
- Joined: Thu Aug 15, 2019 7:30 pm
- Location: USA
How to view the value of a PRIVATE variable in debugger?
I tried both the popup window and MemVarGet and both ways work well. Thanks Robert and Chris.
How to view the value of a PRIVATE variable in debugger?
Hello Chris,
We used it today to view open workareas. This is one of the rare things were (in this case XSharp.RT.Debugger.Functions.DbgShowWorkAreas()) is even better than in VO because you can actually browse through DBF records!
Would it be difficult to add a GoTo(recordnumber) option within that function? As it is -yet- impossible to do that in the IM window (where you get all kind of C# errors and have to guess what the C# equivalent would be) it could probably be a quick to implement that functionality there?
Dick
This is very handy!Chris post=23482 userid=313 wrote: There's a new functionality for that, you need to add a reference to the assembly XSharp.RT.Debugger, and then while debugging you can enter in the Immediate Window:
Btw, there are a few more similar debug windows that can be opened in a similar way:
XSharp.RT.Debugger.Functions.DbgShowWorkAreas() // show info about all open dbfs .
We used it today to view open workareas. This is one of the rare things were (in this case XSharp.RT.Debugger.Functions.DbgShowWorkAreas()) is even better than in VO because you can actually browse through DBF records!
Would it be difficult to add a GoTo(recordnumber) option within that function? As it is -yet- impossible to do that in the IM window (where you get all kind of C# errors and have to guess what the C# equivalent would be) it could probably be a quick to implement that functionality there?
Dick
How to view the value of a PRIVATE variable in debugger?
Hi Dick,
Yeah, I think that should be easy enough. Will look into it, probably we can sneak this in the 2.13.1.0 release next week.
.
Yeah, I think that should be easy enough. Will look into it, probably we can sneak this in the 2.13.1.0 release next week.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu