I'd like to check some invariants on the run. I used to apply `System.Diagnostics.Debug` for that. The code as follows
Should fail but it doesn't. Why?
CODE:
public override void Execute(BarHistory bars, int idx) { System.Diagnostics.Debug.Assert(false); }
Should fail but it doesn't. Why?
Rename
Probably because Wealth-Lab isn't running in debug mode?
System.Diagnostics.Debug.Assert works only when DEBUG flag is set while building the project containing that code/call. The DEBUG compilation flag is generally set when you build your strategy project in Debug mode. It doesn't matter if WL8 is a Debug or Release build.
If your project is already built in Debug mode and you do not see it throwing an exception in the WL8 front-end, it might be because WL8 is catching the exception and suppressing/ignoring it.
If your project is already built in Debug mode and you do not see it throwing an exception in the WL8 front-end, it might be because WL8 is catching the exception and suppressing/ignoring it.
Thanks for the clarification. What's the proper way to assert conditions in WL code?
WLHost.Instance.AddLogItem(...WLColor.Red...)
DrKoch, I tried
Where is the output exactly? Don't see those red lines under `Debug Log` tab.
CODE:
WLHost.Instance.AddLogItem("my-strategy", "msg", WLColor.Red);
Where is the output exactly? Don't see those red lines under `Debug Log` tab.
Tools > Log Viewer.
Your Response
Post
Edit Post
Login is required