Is there a relatively easy way to include a custom 'OnStart()' in every script I create?
My use case:
I am often using Html controls to build UIs in Linqpad. I understand that when I don't use Util.KeepRunning(), breakpoints in the debugger won't be hit in things triggered by events, because the main thread has already ended at this point, and all subsequent event handlers are running in separate threads.
I did a quick experiment where I added:
void OnStart()
{
if (Debugger.IsAttached)
Util.KeepRunning();
}
and as long as I have the 'Break when exception is unhandled' box checked on my query, this does what I need.
I was thinking I'd just like that piece of code to be automatically included in all new scripts I create. I was talking to Claude Sonnet about this and it appears to have hallucinated that such a 'template script' feature exists in Advanced, but I don't see it... so, thanks Claude. ![]()
Curious if anyone else has these kinds of slight annoyances and if they have any suggestions for what I'm sort of trying to accomplish. Likely the best thing is to just add a snippet and remember to use it for UI scripts.