FSharp.Configuration icon indicating copy to clipboard operation
FSharp.Configuration copied to clipboard

Creation of temp dll when run from fsi

Open richardjharding opened this issue 7 years ago • 3 comments

I'm using FSharp Configuration Yaml config provider from an fsx script which is in turn run as part of a scheduled job

This seems to be leaving behind a randomly named temp assembly eg tmpc19f.dll each time its run (which I assume is the representation of the yaml file?) - and sometimes this results in an error "file already exists" - deleting the temp dlls removes the error.

Is this expected and can I change this behaviour?

richardjharding avatar May 09 '17 12:05 richardjharding

Yes, it's how type providers work. About generating truly unique names for the temporary assemblies, I've no idea if it's supported OOB. /cc @dsyme

vasily-kirichenko avatar May 09 '17 12:05 vasily-kirichenko

So Am I better off building a console app exe than using fsx which generates a new one for the same file each time its run?

richardjharding avatar May 09 '17 13:05 richardjharding

We use Path.GetTempFileName(). I can change it to something like Guid.NewGuid().ToString() to avoid collisions.

So Am I better off building a console app exe than using fsx which generates a new one for the same file each time its run?

Yes, it would be more reliable I think. Another option can be to use FAKE to run the script - it caches generated assembly automatically.

vasily-kirichenko avatar May 09 '17 13:05 vasily-kirichenko