Auto-press F5 in sanderling

Is there any way for sanderling to auto-press F5 when a script stops working due to an internal problem? For example, after some rare or occasional error which occur 1-2 time per day.

Yes, I can add this functionality if you upload that bot script to pastebin or github.

Based on progress with development of the framework in the last weeks, this auto-restart now seems simple enough to add.
I can probably make this work with a small change to the script.

This is not about any particular script. I’ve been playing with different scipts for Sanderling at github. And it would be very very helpful to have ‘auto-press F5 functionality’ both for for debugging and regular use. Just in case. :wink:

Thank you for clarifying your use case. I soon have some time to cook something up to support this.

1 Like

I spent some time working on the design to solve this:

One thing I did not see initially

‘Press F5’ means a new bot operation session is started. This, in turn, means that the ‘internal problem’ of the script is visible in the end session log. If the continuation happened in the same session, the ‘internal problem’ of the script would be less visible.

Further context informing the design

Since ‘press F5’ also means that state in script variables is lost, a problem leading to a new start can be actually expensive, since a script might perform some setup activities before value-adding in-game activities are performed.
Because of these costs, it is desirable to have a user interface which supports finding the relevant information in the large amount of data recorded with bot operation.

Candidates for Solutions

The reported problems in scripts which lead to such sporadic failures usually result from using the C# programming language to code the overall bot logic. As the many error reports on the forum show, the runtime exceptions of C# and .NET are an example of how such problems can easily be introduced in script code without even noticing.

So far, the best approach to fix these issues seems to be using a language which is actually suitable for programming bots, offering fewer ways to introduce subtle bugs. For example, it would not contain problematic constructs such as runtime exceptions.

As there are already successful implementations of such languages, necessary tools like compilers, interpreters, static code analysis, libraries could be adapted and reused here, similar to how the C# compiler is integrated with Sanderling. I expect to spend some coffee and time on efforts to make this happen.

On a parallel track, the ‘auto F5’ can be added as a band-aid quick fix to the existing Sanderling app. This functionality could be supported with a command-line argument, analogous to the existing ones.

@AlexBob, I just implemented the auto-press F5 functionality:

This function is supported with a command-line argument, analogous to the existing ones
To use the auto-press F5 functionality, append the argument to the command line starting the Sanderling app as follows:

Sanderling.exe --bot-crash-retry-count-max=4

You can download the Sanderling app with this functionality from

1 Like

Excellent! Thank you! Start testing right now.

Would you please confirm, if auto-press F5 functionality can by used together with --load-bot-from-file and --start-bot parameters? I’ve catched a ‘System.AggregateException’ exception and no auto-restart followed, just message like that:

18-55-43.746: status transition from Running to Failed.

thank you!

Yes, at least nobody has reported a problem with this scenario so far.

I tested this now, using the following commandline:

2019-05-13.Sanderling.exe --load-bot-from-file="bot.csx" --start-bot --bot-crash-retry-count-max=4

Using this with a script that crashes quickly, after the script crash I did not see any difference to pressing F5 manually.

If you see any difference between auto-press F5 and manually pressing F5, I can look into it.

Now I see some potential for confusion, as at some point I thought that F5 would also always imply to start a new bot session. After looking closer, that seems not to always be the case.

Did you expect it to restart? What happens when you press F5 manually?

Yes, I did expect an auto-restart.

Sanderling always auto-restarts just perfect in ‘Development Enviroment’. But when using --load-bot-from-file it’s never auto-restarts. That’s the problem.

Ok, good to know. :+1: I can change the implementation to add auto-restart of the bot.

1 Like