Home
Options

AppDomain.CurrentDomain.Set/GetData no longer works in LinqPad 7

I want to get a fresh copy of some files from a fileshare before running my LinqPad script - but only if I haven't already done that within the last hour.
(I use robocopy for this, but the fileshare is slow, so I'd still prefer to do the check in my own code and not rely on robocopy.)

I was previously doing this by saving the timestamp of the last file copy operation using AppDomain.CurrentDomain.SetData("MyTimestamp", DateTime.Now);
I could then load that timestamp using AppDomain.CurrentDomain.GetData and check if it was more than 1h ago.

However, this stopped working with one of the latest LinqPad 7 versions.
Is there a different way to do this? I could also use LinqPad's own caching for this, if there is a way to configure when the cached value shall expire.

Comments

  • Options

    This should still work, unless you've enabled the option to force a fresh process per execution in Edit | Preferences > Advanced > Execution. Other things that will kill the process are cancellation (unless you enable soft cancellation by monitoring this.QueryCancelToken) or an assembly resolution fault that prevents the query from loading. Otherwise, can you provide a MRE?

  • Options

    I checked the setting and it wasn't checked, didn't make any changes.
    For some strange reason, afterwards it was working again... Thank you!

Sign In or Register to comment.