Using Visual Studio 2012 for debugging Strategies
Author: jgpd
Creation Date: 3/14/2013 10:08 AM
profile picture

jgpd

#1
Hi, I have a question about how I can use Visual Studio 2012 as a debugger for WL Scripts.
I followed your instructions about using Visual Studio (http://www2.wealth-lab.com/WL5Wiki/kbAskGlitchDebug.ashx) and I am able to create and build a strategy.
But where shall I copy the result (dll file)?
I have two locations on my hard-disk where I can see the pre-installed strategies.
One is in "c:\Program Files\MS123\Wealth-Lab Developer 6\Data\Strategies" and the other one is
"c:\Users\jgpd\AppData\Roaming\Fidelity Investments\WealthLabDev\1.0.0.0\Data\Strategies". The second one seems to be the correct one.
But both contains only XML files.
When I place the compiled dll file in one of these directory, nothing happens...
I am using WL Developer 6.4 x64, VS 2012, compile to .NET 4.0, CPU any (without errors).
What is wrong?

Thanks in advance
jgpd

profile picture

Eugene

#2
Hi,

Both locations are incorrect with regard to compiled Strategy libraries. Step 9 refers to the Wealth-Lab installation directory which in your case will be:

c:\Program Files\MS123\Wealth-Lab Developer 6\
profile picture

jgpd

#3
Hi Eugene,
thanks for your quick response.
Using the "c:\Program Files\MS123\Wealth-Lab Developer 6\" folder solves my problem. I can see and run the test strategy inside WealthLab now. And after attaching the debugger to the WealthLab process, I can even debug it from inside VS 2012. Great.
But adding files to the program folder is a bit awkward. This folder is normally protected and readonly.
It would be nice to have a user defined folder for these dll files in a future WL version.

Thanks again for your help
Best Regards
jgpd

profile picture

Eugene

#4
QUOTE:
This folder is normally protected and readonly.

Simply start Visual Studio with admin privileges (right-click on its shortcut and select "Run as admin").
profile picture

sedelstein

#5
New to C# in visual studio and trying to debug some code. I'm comfortable with the of C# language and know how to use the debugger but building more complicated solutions is somewhat new to me.

Can a C# expert here help me with Step 5 on Deriving a class and the code completion to generate a stub?


From http://www2.wealth-lab.com/WL5Wiki/kbAskGlitchDebug.ashx, step 5 is

QUOTE:
5. Derive the class from WealthScript. At this point you can use Visual Studio's code completion to automatically generate a stub for the required "Execute" method.


but I'm not sure how this is done. (that is, deriving the class, and generating the stub) I've seen this done once before by someone and think I can take it from there after this step.

Thanks
profile picture

Eugene

#6
Start creating your Strategy class ("public class..."), inherit from WealthScript (append " :WealthScript"), right click on the "WealthScript" and select "Implement abstract class" OR hover your mouse over the "WealthScript" text until VS2012 shows a popup with the synonymous option.

How to: Implement Abstract Base Classes
profile picture

JamirShaikh

#7
Can we use Visual Studio 2008 with Wealth-Lab 6.6 ?
profile picture

Eugene

#8
No. VS2010 is the minimum version that can target .NET 4.0. It was discussed on the forum:

Start learning C# with Visual Studio programming environment

There's no excuse for not getting VS2012 / VS2013 Express, so just go for it. ;)
profile picture

JamirShaikh

#9
Thank you Eugene!
profile picture

sedelstein

#10
Hello Eugene

I'm going through the steps here http://www2.wealth-lab.com/WL5Wiki/kbAskGlitchDebug.ashx

Got to step 12: Run WealthLab but it fails to start. When I delete the .dll that was built in Visual Studio, it is able to run again.

Steps 1:11 went smoothly

The code is below. Can you think of why WL might fail to start?

UPDATE: I tried using one the the "canned" Active Trader Strategies and got the same result. WealthlLab has stopped working.
I hope it something obvious and simple

CODE:
Please log in to see this code.
profile picture

Eugene

#11
This is happening because Step 6 wasn't completed:

QUOTE:
The Strategy Helper class returns properties that describe details about the Strategy that are needed by Wealth-Lab. Implement the properties in the code of your helper class.


The 5 properties are not implemented, staying stubs and still returning an Exception i.e. your code is set up to "crash". Replace all these lines with getters that return DateTime's and strings: strategy creation/modification date, author, strategy name and a brief description:

CODE:
Please log in to see this code.
profile picture

sedelstein

#12
Ah, Step 6 only discussed GUID and typeof. Didn't realize they all needed return values. Thanks. Back to the drawing board,
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).