Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent File Locking Issue #228

Merged
merged 1 commit into from
Mar 5, 2025
Merged

Conversation

1eyewonder
Copy link
Contributor

Problem

In VSCode I currently have the following settings to enable analyzers in the IDE.

{
    "FSharp.enableAnalyzers": true,
    "FSharp.analyzersPath": [
        "packages/Analyzers"
    ],
}

When switching between branches of my codebase, if there are different versions of my analyzers, I will get an error during the paket restore step due to the files being used. My current workaround is to manually delete the folder listed above and then restore my solution.

Proposed Solution

In order to circumvent this, there appears to be a setting in the package we are consuming to allow loading the assemblies into memory. Looking through the code, it does not appear we are using this setting nor is it overriding any hot reload functionality.

CreateFromAssemblyFile

PluginConfig constructor

@1eyewonder
Copy link
Contributor Author

Here is some additional context natemcmaster/DotNetCorePlugins#87

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I think we wanna test in FSAC to make sure this works as expected.

@1eyewonder
Copy link
Contributor Author

Local FSAC

  • Pointed towards local FSharp.Analyzers.SDK with the proposed changes
    • image
  • Removed references to nuget package
    • image

Delete Script

The below script is what I use to test if a file is locked by Windows

open System.IO

let path = @"packages/analyzers"
Directory.Delete(path, true)

Opening Using Local Repo as Is

  • Analyzers exist upon opening
    • image
  • Analyzers functional
    • image
  • Run the above script
    • image

Opening Using Local Repo & Local FSAC

  • Set local fsac dll path
    • image
  • Analyzers exist upon opening
    • image
  • Analyzers functional
    • image
  • Running the script successfully deletes the packages and does not throw an error
    • image

@TheAngryByrd TheAngryByrd merged commit d873ff8 into ionide:main Mar 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants