-
Notifications
You must be signed in to change notification settings - Fork 830
Description
One of my more "creative" (mischievous?) type providers calls fsc in order to build user-provided code, then performs reflection on the completed assembly. A test script I wrote for it makes use of the type provider, and runs in F# Interactive. After updating to F# 4.1 and FSharp.Core 4.1.0, both the instance of F# Interactive running the test code and the instance of fsc called by the type provider attempt to stash a copy of FSharp.Core.dll in %TEMP%, and fsc fails because that path is locked.
Repro steps
Provide the steps required to reproduce the problem
- Clone my TypeExpansion type provider and
git checkout 1.0.0, then clone the sample templates - Build the TypeExpansion type provider; the
1.0.0release updated the type provider to useFSharp.Coreversion4.1.0, and to usefscfrom the new F# 4.1 locations - In the templates project, open
tests/FromXml/test.fsxand modify the first two lines to point to the locally-built libraries; for me, this means changing them to the following:
#r @"M:\Users\amazingant\GitHub\Amazingant.FSharp.TypeExpansion\Source\Amazingant.FSharp.TypeExpansion\bin\Debug\Amazingant.FSharp.TypeExpansion.Attributes.dll"
#r @"M:\Users\amazingant\GitHub\Amazingant.FSharp.TypeExpansion\Source\Amazingant.FSharp.TypeExpansion\bin\Debug\Amazingant.FSharp.TypeExpansion.dll"- From the root of the templates project, run
./build.cmd RunTeststo run the simple test suite; this test suite uses theFAKE.FSIHelper.executeFSIfunction to call F# Interactive and run thetest.fsxscript - While the tests run, use Process Monitor with a filter on
PathisC:\Users\<your-user-account>\AppData\Local\Temp\FSharp.Core.dll
Expected behavior
While running the tests, the compiler and/or F# Interactive should put any temporary files they think they need into a temporary file path, rather than assuming that %TEMP%/FSharp.Core.dll is available. This could come from System.IO.Path.GetTempFileName() for example.
Actual behavior
Both the compiler and F# Interactive try to lock %TEMP%/FSharp.Core.dll, and whichever process attempted to lock the file later returns an error.
Known workarounds
-
Use the F# 4.0 version of
fsc:- Revert commit f66fee7b968e50710cf4296337a985a5d702f0de in the TypeExpansion code
- Rebuild the type provider
- Re-run the test code
- Via procmon, observe that F# Interactive uses
%TEMP%/FSharp.Core.dll, butfscdoes not
-
Do not reference
FSharp.Coreversion4.1.0from the type provider:- Revert commit ea25117afdb976c3e98b84cc01d1759a79e9b9f7 in the TypeExpansion code
- Rebuild the type provider
- Re-run the test code
- Via procmon, observe that both F# Interactive and
fscuse%TEMP%/FSharp.Core.dll, but neither of them prevent the other from accessing the file
-
Put
FSharp.Coreversion4.1.0into the GAC manually withgacutil- Find
FSharp.Core.dll - Run
gacutil /i <path-to-dll>in an administrative command prompt - Follow the main repro steps again
- Via procmon, observe that F# Interactive no longer puts a copy of
FSharp.Core.dllinto%TEMP%;fscstill does
- Find
My initial assumption was that the new version of FSharp.Core should exist in the GAC after Visual Studio is installed, but after reading some issue comments, it sounds like this may not be the case?
An additional commit in the type provider, commit de731a59fae8b8cb21c11b099678cec8b728fe96, can be reverted as well; this commit changes which version of FSharp.Core is used during the calls to fsc, but appears to have no effect on the results of these tests.
Related information
Provide any related information
- Operating system: Win 10 Pro v1607
- Branch: Installed with latest Visual Studio 2017 RC, Visual F# Tools version is
15.4.1.17020301