Visual Studio 2019 build hangs on Windows 10 seemingly after compile step but still ok on Windows 7
Visual Studio 2019 build hangs on Windows 10 seemingly after compile step but still ok on Windows 7
31 Oct 2022, 14:57
Trying to transfer cBots & indicators development from Windows 7 to Windows 10. Hadn't started cTrader on the Win 7 for a few months, so first change was the automatic upgrade - Win 7 cTrader upgraded itself and Win 10 new install are both now at version 4.2.22.8457.
The builds still complete properly on the Win 7 system, but hang on Win 10, seemingly after the compile step (in that there are some warning messages on both systems about deprecated functions & variables not used etc), but the Win 7 completes (Build Succeeded at bottom of VS 2019 and the dropdown Build menu shows all options) whereas the Win 10 does not (the Build dropdown only shows Run Code Analysis & Cancel, others are greyed out, only way of stopping the build is to kill devenv process tree (I use Process Explorer for that). I've ensured the .NET 4 target is in both VS systems (by looking in Virtual Studio Installer).
I've noticed now, on Win 10 but not on Win 7, that even trying to build using cTrader fails - saying "Error CS0169 The field ... is never used" (on Win 7 this does not show as an error). Maybe there's a setting I've forgotten about, to make this not count as a warning rather than an error?
(update: even though on both VS there is a default setting "Project properties -> Treat warnings as errors: CS0108,CS0162,CS0109,CS0219,CS0169,CS0628" which seems to mean CS0169 should count as an error, the unused variable didn't seem to cause a problem (or even a message) on either VS. Also, commenting out the relevant c# declarations enables build success within Win 10's cTrader (but the VS build on Win 10 still hangs). Small question: how do we allow declaration of unused variables when building in cTrader 4.2.22.8457 on Win 10, and why are they still ok on Win 7 ?!)
Also, I've noticed (in VS menu Extensions -> Manage Extensions) that both systems have version 1.7 of the cBots and Custom Indicators VSIX (as available from MS download) whereas I think earlier, when I started VS on Win 10 via the 'edit in VS' option from cTrader, it may have then installed version 1.9 (I later uninstalled that and installed the 1.7 manually from the download in case the 1.9 was causing problems with old cAlgo items) - does it matter which I have, is there a difference in how the build is passed between VS & cTrader (I read in the cTrader Whats New that builds are in 4.2 now done by separate cAlgo threads rather than in the main one, is this a factor in which of 1.7 or 1.9 is required (but then, VS builds still works with 1.7 on Win 7 so it would seem the VSIX version wouldn't be the cause of failure on Win 10).
What have I missed in "just" moving from Win 7 to Win 10?
martins
02 Nov 2022, 03:15
RE:
martins said:
It seems YOU HAVE TO RUN a copy of AN OLD PRE-4.2 cTrader at least ONCE ON THE NEW PC (just to the point of it displaying its login window is enough) BEFORE YOU CAN BUILD any UNCHANGED Visual Studio solutions or PROJECTS that have been COPIED FROM PRE-4.2, cAlgo.API based systems. Because I'd installed a fresh download on Win 10, I'd only ever run 4.2, never 4.1 or older, and VS2019 was hanging presumably looking for it. I found a copy of 4.1.11.49761 on the Win 7 system in /User/.../AppData/Local/Apps/2.0/??1/??2/xtrader_7ef.../cTrader.exe (the two ?? look like random 8.3 allcaps names so probably vary). I copied the whole ??2 folder and renamed it on Win 10, then ran the copied cTrader.exe - the build of an unchanged old cAlgo cBot solution then build successfully in Virtual Studio 2019 on Win 10. Running the old cTrader just once seems to be enough.
So the fact the new system was Win 10 was irrelevant - the salient point is it was a system that had never run an old version of cTrader that didn't use cTrader.Automate
The clue to this resolution was the initial message produced by a VS build on the old (Win 7) system:
Application: C:\Users\...\AppData\Local\Apps\2.0\XJNZ....\92J...\xtrader_7ef...\cTrader.exe, version: 4.1.11.49761
Compile project: C:\Users\...\Documents\cAlgo\Sources\Robots\name\name\name.csproj
A similar message now appears on the new (Win 10) system when building these unchanged projects. However, I presume it won't be too hard to create new versions for ctrader.Automate & .NET 6 by copying just the main source to cTrader 4.2 and using 'Edit in Virtual Studio' to create a simple version of the project and then adding the other parts of extra source etc back in.
@martins