Skip to content

Conversation

@KevinRansom
Copy link
Contributor

@KevinRansom KevinRansom commented Oct 28, 2020

So we still have some issues loading native dll's in scenarios where the Coreclr does not raise a ResolvingUnmanagedDll event notification.

So ... what we do with this PR, is for any native dll that msbuild identifies as should be copied to the output directory, we add the directory containing that dll to the Path environment variable for the process. This should increase the range of scenarios where native .dll loading currently fails.

I also have made the code netstandard2.0, since fcs is currently netstandard2.0 only.

/cc @jonsequitur --- this should fix the sqllite notebook issue.

@KevinRansom KevinRansom requested a review from brettfo October 28, 2020 02:53

Environment.SetEnvironmentVariable("PATH", path.Replace(probePath + ";", ""))
let mutable _p = null
addedPaths.TryTake(ref _p) |> ignore
Copy link
Member

Choose a reason for hiding this comment

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

I'm having a hard time tracking what these new bits do. Can you refactor to something like let addToPath(existingPath: string, extraDir: string) -> string/let removeFromPath(existingPath: string, removeDir: string) -> string and add unit tests? Then these locations simply pipe in to and out of %PATH%.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addedPaths is the collection of paths that have been added. Collected, so that they can be removed in dispose. But I can refactor some stuff yes.

@KevinRansom KevinRansom force-pushed the usepathfornativebinding branch from 1174a5c to ba8a100 Compare October 29, 2020 03:17
@KevinRansom KevinRansom merged commit a5730e5 into dotnet:main Oct 29, 2020
@KevinRansom KevinRansom deleted the usepathfornativebinding branch October 29, 2020 18:56
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Use path for loading native dependencies

* feedback

* Update Microsoft.DotNet.DependencyManager.fsproj

* Update VisualFSharpFull.csproj
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