Hi
I try to use the Breakpoint in Visual Studio .
If I place a Breakpoint, MC .NET will execute the code of the indicator without stoping on the breakpoint .
How do I make MC stop on Breakpoint ?
Emmanuel
How can we use the Breakpoint under VS ?
Re: How can we use the Breakpoint under VS ?
Hi Dru,
Thank you for your answer,
Do you mean to add MultiCharts.exe as reference in VS ?
I tried to do it but I got an error message, telling me MultiCharts.exe is not a valid COM file
(see attached file)
How do you attach MS VS to process MultiCharts.exe with Managed debugging first ?
Emmanuel
Thank you for your answer,
Do you mean to add MultiCharts.exe as reference in VS ?
I tried to do it but I got an error message, telling me MultiCharts.exe is not a valid COM file
(see attached file)
How do you attach MS VS to process MultiCharts.exe with Managed debugging first ?
Emmanuel
- Attachments
-
- Capture MC NET.JPG
- (218.46 KiB) Downloaded 2201 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How can we use the Breakpoint under VS ?
See Tools -> Attach to process (Ctrl - Alt - P) in Visual Studio.Do you mean to add MultiCharts.exe as reference in VS ?
Re: How can we use the Breakpoint under VS ?
Hi,
The Breakpoints are working but I am "Enable to evaluate the expression"
(See attached)
I can go step by step in the code, but without evaluating the expression
How can we evaluating the expression ?
Emmanuel
P.S : (If I attach a process, MC is working with Managed V 2.0,
Maybe It 's seem that we need to check the CheckBox "Native" and Managed V 4.0 to be able to evaluate the expression.
If I check the checkbox Managed V 4.0, the Breakpoint are not working anymore.)
The Breakpoints are working but I am "Enable to evaluate the expression"
(See attached)
I can go step by step in the code, but without evaluating the expression
How can we evaluating the expression ?
Emmanuel
P.S : (If I attach a process, MC is working with Managed V 2.0,
Maybe It 's seem that we need to check the CheckBox "Native" and Managed V 4.0 to be able to evaluate the expression.
If I check the checkbox Managed V 4.0, the Breakpoint are not working anymore.)
- Attachments
-
- Capture2.JPG
- (87.74 KiB) Downloaded 2241 times
-
- Capture.JPG
- (66.81 KiB) Downloaded 2237 times
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: How can we use the Breakpoint under VS ?
to be clear:
have mc.net running
in vs debug menu select 'attach to Process..'
select the mc.net instance
In VS: Debug/Start
Now go to mc.net and add study*
VS will stop at the breakpoint you have set.
*actually any action which forces the study to recalc will trigger the study to calc
if you have the study attached to a live chart it will trigger on the next update
have mc.net running
in vs debug menu select 'attach to Process..'
select the mc.net instance
In VS: Debug/Start
Now go to mc.net and add study*
VS will stop at the breakpoint you have set.
*actually any action which forces the study to recalc will trigger the study to calc
if you have the study attached to a live chart it will trigger on the next update
Re: How can we use the Breakpoint under VS ?
Hi riverTrader,
It is exactly what I do but, once VS Stop at the breakpoint, can you watch any variable ?
in VS ? for example can you see the value of Close ? in this example :
Protected Overrides Sub CalcBar()
Dim Close As Double
Close = MyBase.Bars.Close.Item(0)
Me.plot1.Set(MyBase.Bars.Close.Item(0))
End Sub
If I put a breakpoint, and watch Close for example
I get the following "Enable to evaluate the expression" in my watch list .
Do you get the same error "Enable to evaluate the expression" ?
It is exactly what I do but, once VS Stop at the breakpoint, can you watch any variable ?
in VS ? for example can you see the value of Close ? in this example :
Protected Overrides Sub CalcBar()
Dim Close As Double
Close = MyBase.Bars.Close.Item(0)
Me.plot1.Set(MyBase.Bars.Close.Item(0))
End Sub
If I put a breakpoint, and watch Close for example
I get the following "Enable to evaluate the expression" in my watch list .
Do you get the same error "Enable to evaluate the expression" ?
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: How can we use the Breakpoint under VS ?
Emmanuel,
Sure you can. Actually there are many ways to see the value of a current variable in VS; experiment with the IDE and get a feel for each and when you might use them.
Let's use the Mov_Avg_1_Line indicator as an example
set a breakpoint at m_avg.DefaultValue = 0;
Start your debugging session then go to the Debug/Windows menu and open Debug/Windows/Watch and Debug/Windows/Locals windows
if you are at your breakpoint, the local variables in your method will appear in the locals window
Now, hover your mouse over the 'price' variable; notice that the current value appears in a popup. Hover over m_averagefc1.price (over the 'price' dotted reference) and you will see the same value;
Note that m_avg.DefaultValue does not yet have a value because the code has stopped prior to the value being set.
Now, right click on the m_averagefc1.price variable and select "Add Watch". (click on 'price') You'll see the m_averagefc1.price appear in the Watch1 window (you can have many watches open).
Now, select the 'm_averagefc1' text rather than 'price'; you'll see the m_averagefc1 appear in the watch window with a plus sign next to it. Click on the plus sign and notice that the price variable is included, along with the other variables of the m_averagefc1 object
Finally, select the m_avg text and copy it; now go to the watch window and past it in the empty row at the bottom.
Bonus:
Open the Debug/Windows/Immediate window. Copy/Paste 'm_averagefc1.price' in the immediate window; The current value will appear in the window below the text
Now, click on the immediate window and hit the up arrow. m_averagefc1.price will appear. Type in:
m_averagefc1.price = 907;
yes, you can change the value of a variable while your indicator is running. There are various reasons to do this, to see what happens if you put in a wildly out-of-range value, or to debug a complex method.
The other REALLY great feature of the immediate window is it allows you to write a new snippet of code and try it out in real-time.
have fun!
Sure you can. Actually there are many ways to see the value of a current variable in VS; experiment with the IDE and get a feel for each and when you might use them.
Let's use the Mov_Avg_1_Line indicator as an example
set a breakpoint at m_avg.DefaultValue = 0;
Start your debugging session then go to the Debug/Windows menu and open Debug/Windows/Watch and Debug/Windows/Locals windows
if you are at your breakpoint, the local variables in your method will appear in the locals window
Now, hover your mouse over the 'price' variable; notice that the current value appears in a popup. Hover over m_averagefc1.price (over the 'price' dotted reference) and you will see the same value;
Note that m_avg.DefaultValue does not yet have a value because the code has stopped prior to the value being set.
Now, right click on the m_averagefc1.price variable and select "Add Watch". (click on 'price') You'll see the m_averagefc1.price appear in the Watch1 window (you can have many watches open).
Now, select the 'm_averagefc1' text rather than 'price'; you'll see the m_averagefc1 appear in the watch window with a plus sign next to it. Click on the plus sign and notice that the price variable is included, along with the other variables of the m_averagefc1 object
Finally, select the m_avg text and copy it; now go to the watch window and past it in the empty row at the bottom.
Bonus:
Open the Debug/Windows/Immediate window. Copy/Paste 'm_averagefc1.price' in the immediate window; The current value will appear in the window below the text
Now, click on the immediate window and hit the up arrow. m_averagefc1.price will appear. Type in:
m_averagefc1.price = 907;
yes, you can change the value of a variable while your indicator is running. There are various reasons to do this, to see what happens if you put in a wildly out-of-range value, or to debug a complex method.
The other REALLY great feature of the immediate window is it allows you to write a new snippet of code and try it out in real-time.
have fun!
Re: How can we use the Breakpoint under VS ?
Hi riverTrader,
I try it work well under C#, I can watch, and see under Local "This" with all the variable !
But when I try an example in VB , I have nothing under Local, I have the same error message :
"Enable to evaluate the expression"
Would you try this example ? :
Are you able to see the local variable, can you watch a variable ?
for example if you put a breakpoint on Me.plot1.Set(MyBase.Bars.Close.Item(0))
can you have the value of MyBase.Bars.Close.Item(0) ?
Emmanuel
I try it work well under C#, I can watch, and see under Local "This" with all the variable !
But when I try an example in VB , I have nothing under Local, I have the same error message :
"Enable to evaluate the expression"
Would you try this example ? :
Code: Select all
Imports System
Imports System.Drawing
Imports PowerLanguage
Imports PowerLanguage.Indicator
Imports PowerLanguage.Function
Imports System.Linq
Namespace PowerLanguage.Indicator
Public Class TestA
Inherits IndicatorObject
Private Test As Int16
Public Sub New(ByVal _ctx As Object)
MyBase.New(_ctx)
End Sub
Protected Overrides Sub CalcBar()
Me.plot1.Set(MyBase.Bars.Close.Item(0))
End Sub
Protected Overrides Sub Create()
Me.plot1 = MyBase.AddPlot(New PlotAttributes("", EPlotShapes.Line, Color.Red))
End Sub
Protected Overrides Sub StartCalc()
End Sub
Private plot1 As IPlotObject
End Class
End Namespace
for example if you put a breakpoint on Me.plot1.Set(MyBase.Bars.Close.Item(0))
can you have the value of MyBase.Bars.Close.Item(0) ?
Emmanuel
-
- Posts: 64
- Joined: 15 Aug 2011
- Has thanked: 3 times
- Been thanked: 50 times
Re: How can we use the Breakpoint under VS ?
Hmm. I'm afraid I can't answer. I just don't ever use VB. My guess (totally a guess) is VB deals with the (this) variable differently.
C#. Try it; you'll like it.
BTW, in case you didn't know it "this" refers to the instance of your Indicator object in the debugger. In general avoid putting 'this' into a watch window while you are debugging as I doing so forces the debugger to resolve the value of every variable (not quite, but close) at every breakpoint, okay for a few simple checks, but can bog down the debugger if you are clicking through say 100 bars of your indicator to see the intermediate results.
In general, put just the variable or object you are interested in in the watch window.
C#. Try it; you'll like it.
BTW, in case you didn't know it "this" refers to the instance of your Indicator object in the debugger. In general avoid putting 'this' into a watch window while you are debugging as I doing so forces the debugger to resolve the value of every variable (not quite, but close) at every breakpoint, okay for a few simple checks, but can bog down the debugger if you are clicking through say 100 bars of your indicator to see the intermediate results.
In general, put just the variable or object you are interested in in the watch window.
Re: How can we use the Breakpoint under VS ?
Hi
When I use Visual Studio, I "attach to process", to be able to debug an indicator under multicharts .NET.
It work well under C#:
I can see in the "watch windows" to watch a value of a variable, or see "This" in the "Local variable" with all the value of the variable on a breakpoint.
BUT When I do the same, on a breakpoint, with Visual Basic (on the Following example), I have nothing under Local variable, if I "Watch" the value of a variable, I have the error message : "Enable to evaluate the expression". (See attached file)
I can go step by step in the code, the Breakpoint are working, but without evaluating the expression, I am getting "Enable to evaluate the expression (See attached file)
How can we see the value of a variable the expression on VB ? and get ride of the error message "Enable to evaluate the expression"
Here is a VB example :
Can you read in Visual Studio the value of Close ?
When I use Visual Studio, I "attach to process", to be able to debug an indicator under multicharts .NET.
It work well under C#:
I can see in the "watch windows" to watch a value of a variable, or see "This" in the "Local variable" with all the value of the variable on a breakpoint.
BUT When I do the same, on a breakpoint, with Visual Basic (on the Following example), I have nothing under Local variable, if I "Watch" the value of a variable, I have the error message : "Enable to evaluate the expression". (See attached file)
I can go step by step in the code, the Breakpoint are working, but without evaluating the expression, I am getting "Enable to evaluate the expression (See attached file)
How can we see the value of a variable the expression on VB ? and get ride of the error message "Enable to evaluate the expression"
Here is a VB example :
Code: Select all
Imports System
Imports System.Drawing
Imports PowerLanguage
Imports PowerLanguage.Indicator
Imports PowerLanguage.Function
Imports System.Linq
Namespace PowerLanguage.Indicator
Public Class TestA
Inherits IndicatorObject
Private Test As Int16
Public Sub New(ByVal _ctx As Object)
MyBase.New(_ctx)
End Sub
Protected Overrides Sub CalcBar()
Dim Close As Double
Close = MyBase.Bars.Close.Item(0)
Me.plot1.Set(MyBase.Bars.Close.Item(0))
End Sub
Protected Overrides Sub Create()
Me.plot1 = MyBase.AddPlot(New PlotAttributes("", EPlotShapes.Line, Color.Red))
End Sub
Protected Overrides Sub StartCalc()
End Sub
Private plot1 As IPlotObject
End Class
End Namespace
- Attachments
-
- Capture.JPG
- (66.81 KiB) Downloaded 2336 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: How can we use the Breakpoint under VS ?
Hello Emmanuel,Hi
When I use Visual Studio, I "attach to process", to be able to debug an indicator under multicharts .NET.
It work well under C#:
I can see in the "watch windows" to watch a value of a variable, or see "This" in the "Local variable" with all the value of the variable on a breakpoint.
BUT When I do the same, on a breakpoint, with Visual Basic (on the Following example), I have nothing under Local variable, if I "Watch" the value of a variable, I have the error message : "Enable to evaluate the expression". (See attached file)
I can go step by step in the code, the Breakpoint are working, but without evaluating the expression, I am getting "Enable to evaluate the expression (See attached file)
How can we see the value of a variable the expression on VB ? and get ride of the error message "Enable to evaluate the expression"
Can you read in Visual Studio the value of Close ?
This issue is confirmed. It will be fixed in one of the future versions of MultiCharts .Net