ionide / proj-info

Parse and evaluate MsBuild project files
MIT License
64 stars 37 forks source link

Fix access error while reading project files. #175

Closed sheridanchris closed 1 year ago

sheridanchris commented 1 year ago

This PR will fix an exception occurring from unauthorized access of a sub-directory in scanDirs This will close #174

I created a new function for error handling and returned empty arrays to keep the sequence expression in scanDirs relatively the same. I was unsure what to do when encountering an exception so I decided to add similar logging logic to what's already present in the repository.

I'm unsure how I would add tests for this.

Any feedback would be much appreciated! (I forgot to create a new branch on my fork... sorry about that)

baronfel commented 1 year ago

Yeah, it does seem that testing this would be hard to do. If you have a local repo where this error exists, you could build this project and drop the built DLL into the FSAC install you're using (for Ionide this would be in the ~/.vscode/extensions/ionide.ionide-fsharp-VERSION/bin/ folder, specifically in both the net6.0 and net7.0 subfolders of that folder), then restart the server. Since you didn't make any API-level changes it should just drop right in.

sheridanchris commented 1 year ago

I've tested it locally and it's partially fixed. However, there seem to be a few more instances of these exceptions. I'll work on fixing them. Thanks for the guidance!

sheridanchris commented 1 year ago

That should be it. The issue no longer occurs locally.

baronfel commented 1 year ago

Awesome! Thank you for taking the time to dig into this, I expect this was a common-but-hard-to-debug error for many users.

baronfel commented 1 year ago

I'll work on making a release of this later today so we can flow it into FSAC. There are other FSAC fixes we want to release as well so this should roll up into those.