VS2022 and cAlgo; Trouble with debugging

Created at 03 Oct 2022, 17:17
SH

Shares4us

Joined 01.04.2020

VS2022 and cAlgo; Trouble with debugging
03 Oct 2022, 17:17


1. VS2022 not updating code.
2. Debugger.Launch / break not fired. (at least not always??) and if it does only the breakpoints in the VS2022 build code fire.
3. breakpoints not hit.

This is troublesome because 1 & 2 together mean you cannot practically debug!

I tested it yesterday again.
What I did & the result is/are:

I'm using cTrader 4.3.12 and VS2022 17.3.1
VS2022 settings:
 Base output path: |bin/ (standard setting)
 Base intermediate output path: |obj/ (standard setting)
 JIT enabled for managed only (standard setting)
 Just My Code enabled (standard setting)


vs2022
- create new console App project (net 6.0)
- reference cTrader.Automate (1.0.2)
Set contents of Program.cs to:

using cAlgo.API;

namespace cTrader
{
    public class Lib
    {
        public static void Main() { }
        public static void SayHi(Indicator indicator) =>
            indicator.Print("Hi to " + indicator.ToString() + " from ctrader.Lib.SayHi()");
    }
}

in vs2022 press build => build solution.

Set a breakpoint on the "indicator.Print("Hi to " + indicator.ToString() + " from ctrader.Lib.SayHi()");" line.
 

open cTrader.
choose automate => indicators.
click new
open source
manage references => browse => browse
find C:\Users\xxxx\Documents\cAlgo\Sources\cTraderLib\bin\Debug\net6.0\cTraderLib.dll
double click it.
click Apply

Set contents of Program.cs to:

using cAlgo.API;
using cTrader;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        string Version = "1.0";
        protected override void Initialize()
        {
            System.Diagnostics.Debugger.Launch();
            System.Diagnostics.Debugger.Break();
            Print(this.ToString() + " " + Version + " started");
            Lib.SayHi(this);
        }

        public override void Calculate(int index) { }
    }
}

press the cTrader build button.

Add an instance to the indicator (e.g. EURUSD) and press the Log Tap
it says:
03/10/2022 06:24:38.346 | NewIndicator 1.0 started
03/10/2022 06:24:38.346 | Hi to NewIndicator from ctrader.Lib.SayHi()
03/10/2022 06:24:37.939 | Indicator instance [New Indicator, EURUSD, h1] loaded.

thus bypassing (sometimes) the 
   ❓ System.Diagnostics.Debugger.Launch();
   ❓ System.Diagnostics.Debugger.Break();
statements.

click the 3 vertical dots on the NewIndicator and choose 'Edit in Visual Studio'
In VS2022 change the line in New Incicator.cs 
from  string Version = "1.0"; to  string Version = "1.1";
in vs2022 press build => build solution.

Change the timeframe on the chosen instance. The indicator will restart.
press the Log Tap
it says:
03/10/2022 06:31:23.304 | NewIndicator 1.0 started
03/10/2022 06:31:23.304 | Hi to NewIndicator from ctrader.Lib.SayHi()
03/10/2022 06:31:23.257 | Indicator instance [New Indicator, EURUSD, m1] loaded.
03/10/2022 06:31:23.242 | Indicator instance [New Indicator, EURUSD, h1] unloaded.

Notice 2 things.
Debugger was not launched.(sometimes)
The indicator is still version 1.0 instead of the expected 1.1.

press the cTrader build button.
press the Log Tap
it says:
03/10/2022 06:35:09.085 | NewIndicator 1.1 started
03/10/2022 06:35:09.085 | Hi to NewIndicator from ctrader.Lib.SayHi()
03/10/2022 06:35:08.632 | Indicator instance [New Indicator, EURUSD, m1] loaded.
03/10/2022 06:35:08.539 | Indicator instance [New Indicator, EURUSD, m1] unloaded.

Notice 2 things.
Debugger was not launched.(sometimes)
✅The indicator is updated to version 1.1 which was to be expected.

Also notice:
in VS2022 Debug => Attach to process ..
Attaching the debugger to a process (algohost.netcore) is undoable because of the many processes with the same name.
Selecting a window option in 'Attach to process' is also not working.

Anyone any idea how / where this goes wrong?

✅✅​​​​​​​✅​​​​​​​UPDATE✅​​​​​​​✅​​​​​​​✅​​​​​​​
Problem solved with the newest nuget automate release :-)


@Shares4us
Replies

Xavier R
10 Oct 2022, 22:57

RE: RE: RE:

Hello Spotware,

Here are my steps to reproduce this issue, I find little info about this on internet, and never happened to me before, would appreciate your help.

10.10.2022-14.51.58 (screencast.com)

Regards,

 


@Waxy

Panagiotis Aieden Technologies
04 Oct 2022, 08:00

Hi Shares4Us,

Make sure your cBots/Indicators have AccessRights set to FullAccess.

Aieden Technologies

Need Help? Join us on Telegram

 


@PanagiotisChar

Shares4us
05 Oct 2022, 16:38

RE:

PanagiotisChar said:

Hi Shares4Us,

Make sure your cBots/Indicators have AccessRights set to FullAccess.

Aieden Technologies

Need Help? Join us on Telegram

 

I'll check.


@Shares4us

acrigney
05 Oct 2022, 16:40

RE:

Mate as I said before I have been using Ctrade for 3 years now and had no problems with debugging till now. I am using the latest version which is 4.3.13.9323, can you post a youtube with this version?

Best Regards,

                          Alistair

 

PanagiotisChar said:

Hi Shares4Us,

Make sure your cBots/Indicators have AccessRights set to FullAccess.

Aieden Technologies

Need Help? Join us on Telegram

 

 


@acrigney

Panagiotis Charalampous
05 Oct 2022, 16:43

RE: RE:

Mate,

If you haven't noticed there has been a major update of cTrader during the last months and the debugging procedure has changed. I am using cTrader for six years now and I had to get accustomed to the new process.

Aieden Technologies

Need Help? Join us on Telegram

acrigney said:

Mate as I said before I have been using Ctrade for 3 years now and had no problems with debugging till now. I am using the latest version which is 4.3.13.9323, can you post a youtube with this version?

Best Regards,

                          Alistair

 

PanagiotisChar said:

Hi Shares4Us,

Make sure your cBots/Indicators have AccessRights set to FullAccess.

Aieden Technologies

Need Help? Join us on Telegram

 

 

 


@PanagiotisCharalampous

Shares4us
06 Oct 2022, 13:39

RE: RE: RE:

I checked and alterred the rights to FullAccess. That worked partially.
The debugger wil now Launch but ....

When build in vs2022 the created binary is still not used. (See the version problem (See initial Post at  "
The indicator is still version 1.0 instead of the expected 1.1."

So debugging still not possible.

The problem boils down to:

When building by means of VS2022, the .dll is updated but no .algo file is created in the indicators directory

When building by means of cTrader, the .dll is updated and a .algo file is created in the indicators directory

 

Nasty !


@Shares4us

Shares4us
06 Oct 2022, 13:40

 

 


@Shares4us

acrigney
08 Oct 2022, 05:40

RE: RE: RE: RE:

Guys I rebuilt with Ctrader but still can't debug. Could someone post a youtube of how to debug with the latest version of cTrader?

Shares4us said:

I checked and alterred the rights to FullAccess. That worked partially.
The debugger wil now Launch but ....

When build in vs2022 the created binary is still not used. (See the version problem (See initial Post at  "
The indicator is still version 1.0 instead of the expected 1.1."

So debugging still not possible.

The problem boils down to:

When building by means of VS2022, the .dll is updated but no .algo file is created in the indicators directory

When building by means of cTrader, the .dll is updated and a .algo file is created in the indicators directory

 

Nasty !

 


@acrigney

Shares4us
08 Oct 2022, 15:23

RE: RE: RE: RE: RE:

Sorry, Can't help you here, they took me off cTrader to another development project, I hope I can come back when they get their act together.
It's weird that such an important feature is not fail-safe and not working, did they even test it on VS2022 and win11?
It's sickening to see that we still can not Debug and that the silence of Spotware is deafening.

 


@Shares4us

cTrader Team
10 Oct 2022, 08:17

Dear traders,

We are not able to reproduce any of the aforementioned issues. If you can record a video with the exact steps you are following, we are happy to have a look and advise.

Best Regards,

cTrader Team


@Spotware

Shares4us
10 Oct 2022, 14:26

RE:

this video shows vs2022 build is not updating cTrader executables


@Shares4us

acrigney
10 Oct 2022, 14:56

RE: RE:

This is exactly what I see except he did not show the attempt to debug which then does not work for a .net 6 bot or a .net 4.8 bot. And beak points are not hit on start or when backtesting.

Shares4us said:

this video shows vs2022 build is not updating cTrader executables


@acrigney

... Deleted by UFO ...

acrigney
10 Oct 2022, 16:56

RE:

There must be some other config settings?

PanagiotisChar said:

Weird,

Looks good on my side 

https://pcharalampous-spotware.tinytake.com/msc/NzQzOTEwMl8yMDM0MDMxMg

Aieden Technologies

Trade with us

 


@acrigney

Shares4us
10 Oct 2022, 21:47

RE: RE:

acrigney said:

There must be some other config settings?

MIght be so i reinstalled cTrade and vs2022. No avail ;-( 


@Shares4us

cTrader Team
11 Oct 2022, 08:09

RE: RE: RE: RE:

Waxy said:

Hello Spotware,

Here are my steps to reproduce this issue, I find little info about this on internet, and never happened to me before, would appreciate your help.

10.10.2022-14.51.58 (screencast.com)

Regards,

 

Dear Waxy,

We are not sure which issue are you trying to highlight in the video. The breakpoint seems to trigger fine.

Best Regards,

cTrader Team


@Spotware

Xavier R
11 Oct 2022, 08:20

RE: RE: RE: RE: RE:

The problem is that this message is always showing up since last updates, I would like to have it fixed:

System.Private.CoreLib.pdb not included


@Waxy

acrigney
11 Oct 2022, 09:38

RE: RE: RE: RE: RE: RE:

Waxy said:

and where should I see that? I only see that the symbols fail to load.

really hope we can fix this urgently my clients are waiting!

The problem is that this message is always showing up since last updates, I would like to have it fixed:

System.Private.CoreLib.pdb not included

 


@acrigney

Shares4us
18 Oct 2022, 14:07

RE: omplete list of mandatory Conditions and Settings needed in VS2022 to ensure Debugging

Spotware said:

Dear traders,

We are not able to reproduce any of the aforementioned issues. If you can record a video with the exact steps you are following, we are happy to have a look and advise.

Best Regards,

cTrader Team

Yep so we still cannot debug here!
Maybe this should get some priority at Spotware!
If you have no clue what the error might be (since 4.4) then
Please provide us  with a complete list of mandatory Conditions and Settings needed in VS2022 to ensure Debugging and updating the running algo!


@Shares4us

Shares4us
18 Oct 2022, 15:39

RE:

PanagiotisChar said:

Weird,

Looks good on my side 

https://pcharalampous-spotware.tinytake.com/msc/NzQzOTEwMl8yMDM0MDMxMg

Aieden Technologies

Trade with us

Yep that works on my site too. But if i build in VS it does not work. (See my example)


@Shares4us

Shares4us
27 Oct 2022, 17:40

RE: RE:

Problem solved with the newest nuget automate release :-)

 


@Shares4us

acrigney
17 Nov 2022, 15:38

Still not working for me With VS2022 17.3.4 and Ctrader Automate version 1.0.4 (which is the latest version)

With Ctrader 4.4.19 a new fresh bot and when you hit start you still see no symbols have been loaded.

Shares4us said:

Problem solved with the newest nuget automate release :-)

 

 


@acrigney

Xavier R
18 Dec 2022, 01:16

RE: Still not working for me With VS2022 17.3.4 and Ctrader Automate version 1.0.4 (which is the latest version)

So, in case someone is still experiencing this issue, I was able to sort it out by changing the kind of debug symbols, inside the project properties, changed it to PDB file, current platform:

The System.Private.Core issue is still present in some of my solutions though

Regards,


@Waxy

cTrader Team
09 Jan 2023, 11:41

Dear Waxy,

Can you please change the setting to "Load all modules" and try his scenario one more time? 

Best regards,

cTrader Team


@Spotware

cTrader Team
16 Jan 2023, 15:01

Dear Waxy,

When the VS debugger is launched and waiting (time 2:06 in your previous video https://www.screencast.com/t/grccRl2P) please do following:

1. Go to the "Debug" -> "Windows" menu and click on "Modules"

2. Find the System.Private.CoreLib.dll, open its context menu and click "Load"

3. After that open the context menu again and click "Symbol Load Information..."

4. There should be log like below

Please copy the full log and paste it here.

Best regards,

cTrader Team


@Spotware

Xavier R
23 Jan 2023, 06:48

Hello Spotware, sorry for the late reply.

I'm unable to replicate the same behavior, I'm getting this window now:



Here are the Logs of System.Core.Lib but I don't know if they will be useful now

C:\Users\USUARIO\AppData\Local\Spotware\cTrader\abb70432efbee65d18af69e79fe8efe1\app_4.5.7.12682\x64\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
C:\Users\USUARIO\AppData\Local\Spotware\dotnet\shared\Microsoft.NETCore.App\6.0.0\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
D:\a\_work\1\s\artifacts\obj\coreclr\System.Private.CoreLib\x64\Release\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57c2d4282221452cad4df86bbd5d6fa0ffffffff\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\System.Private.CoreLib.pdb\57c2d4282221452cad4df86bbd5d6fa0ffffffff\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57c2d4282221452cad4df86bbd5d6fa01\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\System.Private.CoreLib.pdb\57c2d4282221452cad4df86bbd5d6fa01\System.Private.CoreLib.pdb: Cannot find or open the PDB file.
SYMSRV:  BYINDEX: 0x1
         C:\Users\USUARIO\AppData\Local\Temp\SymbolCache*https://msdl.microsoft.com/download/symbols
         System.Private.CoreLib.pdb
         57C2D4282221452CAD4DF86BBD5D6FA0ffffffff


SYMSRV:  UNC: C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57C2D4282221452CAD4DF86BBD5D6FA0ffffffff\System.Private.CoreLib.pdb - file not found


SYMSRV:  UNC: C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57C2D4282221452CAD4DF86BBD5D6FA0ffffffff\System.Private.CoreLib.pd_ - file not found


SYMSRV:  UNC: C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57C2D4282221452CAD4DF86BBD5D6FA0ffffffff\file.ptr - file not found


SYMSRV:  HTTPGET: /download/symbols/index2.txt


SYMSRV:  HttpQueryInfo: 80190194 - HTTP_STATUS_NOT_FOUND


SYMSRV:  HTTPGET: /download/symbols/System.Private.CoreLib.pdb/57C2D4282221452CAD4DF86BBD5D6FA0ffffffff/System.Private.CoreLib.pdb


SYMSRV:  HttpQueryInfo: 801900c8 - HTTP_STATUS_OK


SYMSRV:  System.Private.CoreLib.pdb from https://msdl.microsoft.com/download/symbols: 1633924 bytes 

SYMSRV:  PATH: C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57C2D4282221452CAD4DF86BBD5D6FA0ffffffff\System.Private.CoreLib.pdb


SYMSRV:  RESULT: 0x00000000


https://msdl.microsoft.com/download/symbols: Symbols downloaded from symbol server.
C:\Users\USUARIO\AppData\Local\Temp\SymbolCache\System.Private.CoreLib.pdb\57C2D4282221452CAD4DF86BBD5D6FA0ffffffff\System.Private.CoreLib.pdb: Symbols loaded.

 


@Waxy

Xavier R
10 Jan 2023, 21:34

RE:

Spotware said:

Dear Waxy,

Can you please change the setting to "Load all modules" and try his scenario one more time? 

Best regards,

cTrader Team

Hello Spotware, 

You can see I have Load all modules checked, but still, it doesn't work, would appreciate your support:
Regards,




 

 


@Waxy