How to flush PrintDebug?
Author: QuinnHarris
Creation Date: 3/11/2010 4:32 PM
profile picture

QuinnHarris

#1
I have been using WealthLab 5 a bit and have had some frustrations debugging and some other things. Are there better workarounds, possible fixes or general suggestions for these issues?

PrintDebug appears to not aggressively flush to the debug window. If something in the script causes an infinite loop, the strings from the PrintDebug statements executed before the loop will not be flushed to the "Debug and Error Message" log. In the following code, the "TEST" debug message will never make it to the debug window.

CODE:
Please log in to see this code.


In this case I also have to terminate WealthLab entirely. Is there not a way to terminate the script and get a backtrace?

All runtime errors appear to not have an associated line number for the WealthLab script (though I have seen line numbers from referenced assemblies). This also makes debuging harder. Can or will this be fixed?

If I change the strategy XML file while WealthLab is loaded it doesn't reread the file. This makes it awkward to use another text editor or version control (GIT, subversion). The C# code in an XML file also makes it more difficult to use a better text editor (vim, emacs) that understands c#.

Is there a way to run a strategy entirely within Visual C# to take advantage of the marginally better text editor (panes) and debugging.




profile picture

Cone

#2
PrintDebug is not supposed to flush. See FlushDebug().

QUOTE:
All runtime errors appear to not have an associated line number for the... Can or will this be fixed?
No.

QUOTE:
Is there a way to run a strategy entirely within Visual C# ...
Yes. See this WL5 Wiki article.

profile picture

Eugene

#3
QUOTE:
If I change the strategy XML file while WealthLab is loaded it doesn't reread the file. This makes it awkward to use another text editor or version control (GIT, subversion).

This is by design. Note: this is true for any other XML config file, like Symbol Info Manager's configuration, etc.
QUOTE:
The C# code in an XML file also makes it more difficult to use a better text editor (vim, emacs) that understands c#.

Not sure what kind of issue you're talking about. There are other better text editors that have no trouble reading C# within XML - Programmer's Notepad 2 is one such example.
profile picture

DavidOwen

#4
I've been away from WLP for a while. I use to step through programs for debugging WLP with built in tool. Now I'm using 6.8.

Is visual studio required for debugging/tracing line by line?

profile picture

Eugene

#5
Depends on your code's complexity. PrintDebug may be sufficient for simple tasks. For serious ones you'll find Visual Studio indispensable.
profile picture

DavidOwen

#6
I use PrintDebug to send messages, but is the breakpoint and stepping through the code while watching variables still supported within WLP6.8 or not?
profile picture

Eugene

#7
They have never been supported in WL5/6. This is why you'd want to use Visual Studio (SharpDevelop).
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).