fsprojects / FSharpx.Extras

Functional programming and other utilities from the original "fsharpx" project
https://fsprojects.github.io/FSharpx.Extras/
The Unlicense
682 stars 146 forks source link

File system watchers are not held and/or disposed #268

Closed ghost closed 9 years ago

ghost commented 10 years ago

The helper here https://github.com/fsharp/fsharpx/blob/master/src/FSharpx.TypeProviders/TypeProvider.Helper.fs#L24

creates a FileSystemWatcher but never disposes it. This will result in either memory leaks or early disposal of the watcher (and hence events won't be raised).

A handle to the FileSystemWatcher should be kept in the type provider object and IDisposable should be implemented by the type provider object. Compare with this

https://github.com/fsharp/fsharp/blob/master/src/fsharp/FSharp.Data.TypeProviders/TypeProviders.fs#L265

forki commented 10 years ago

We should probably upgrade the TypeProvider.fs and remove the watchForChanges stuff

ghost commented 10 years ago

We should probably upgrade the TypeProvider.fs and remove the watchForChanges stuff

Nah, that "TypeProviders.fs" I linked to isn't the TypeProviderEmit API, it's the implementation of the FSharp.Data.TypeProviders.dll. There's not currently any reusable helpers for managing this.

forki commented 10 years ago

Seems this bug has been spread all over the type providers...

ovatsus commented 10 years ago

@forki, I fixed it in FSharp.Data, you can merge from there if you want

ovatsus commented 10 years ago

https://github.com/fsharp/FSharp.Data/pull/237 and https://github.com/fsharp/FSharp.Data/pull/238

forki commented 10 years ago

It seem I need someone to make it compile in VS2013 first

ovatsus commented 10 years ago

what do you mean?

forki commented 10 years ago

The .fsproj files are completely broken in VS2013 and do not compile. Probably the same as https://github.com/fsharp/FAKE/issues/180

ovatsus commented 10 years ago

Humm, it's building for me both in VS2013 and VS2012

fsgit commented 9 years ago

Closing as the type providers have all been moved to other projects like https://github.com/fsprojects/FSharp.Configuration and https://github.com/fsprojects/ExcelProvider