Sdk: DotNet Run for F# on OS X giving access error

Created on 15 Feb 2016  Â·  29Comments  Â·  Source: dotnet/sdk

If I create a new F# project using the DotNet CLI I get an access error on compile see blow console output

Gavins-MacBook-Air:fsharperror gavindraper$ dotnet new -l f#
Created new F# project in /Users/gavindraper/fsharperror.
Gavins-MacBook-Air:fsharperror gavindraper$ botnet restore
log  : Restoring packages for /Users/gavindraper/fsharperror/project.json...
info :   CACHE https://dotnet.myget.org/F/dotnet-core/api/v3/flatcontainer/microsoft.netcore.platforms/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/index.json
info :   GET https://www.myget.org/F/fsharp-daily/api/v3/flatcontainer/microsoft.netcore.platforms/index.json.
info :   NotFound https://www.myget.org/F/fsharp-daily/api/v3/flatcontainer/microsoft.netcore.platforms/index.json 488ms
log  : Committing restore...
log  : Restore completed in 3382ms.
NuGet Config files used:
    /Users/gavindraper/fsharperror/NuGet.Config
    /Users/gavindraper/.nuget/NuGet/NuGet.Config
Feeds used:
    https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
    https://api.nuget.org/v3/index.json
    https://www.myget.org/F/fsharp-daily/api/v3/index.json
Gavins-MacBook-Air:fsharperror gavindraper$ dot net run
Compiling fsharperror for DNXCore,Version=v5.0
/usr/local/share/dotnet/bin/dotnet compile-fsc @/Users/gavindraper/fsharperror/obj/Debug/dnxcore50/dotnet-compile.rsp returned Exit Code 1
/Users/gavindraper/fsharperror/error FS0193: Access to the path '/usr/local/share/dotnet/bin' is denied.

Compilation failed.
    0 Warning(s)
    1 Error(s)

Time elapsed 00:00:06.1663319
Bug

Most helpful comment

@ctaggart there is pr dotnet/cli#1898 ready to be merged with this and other fixes

All 29 comments

Interesting...why is it trying to get access to the installed location of the CLI?

/cc @enricosada

to execute corerun fsc.exe is one option, but corerun is +x i think.

I can repro in the mac and travisci. I'll fix it

Btw @blackdwarf it's possibile to have a label lang-f# or something like that? There is lot of activity in this repo, it's easier for me (and others) to track F# specific issues (i didnt see this one)

I'm hitting this too.

@enricosada Do you have an ETA for this?

is there a workaround to get it going before the fix is released?

Same problem here with Ubuntu 14.04 x86_64 and dotnet 1.0.0.001573-1 package.

Here is some strace related match to fs..exe:

10383 lstat("/usr/share/dotnet/bin/fsi.exe", {st_mode=S_IFREG|0644, st_size=299008, ...}) = 0
10383 lstat("/usr/share/dotnet/bin/fsc.exe", {st_mode=S_IFREG|0644, st_size=9216, ...}) = 0
10391 lstat("/usr/share/dotnet/bin/fsi.exe", {st_mode=S_IFREG|0644, st_size=299008, ...}) = 0
10391 lstat("/usr/share/dotnet/bin/fsc.exe", {st_mode=S_IFREG|0644, st_size=9216, ...}) = 0
10405 execve("/usr/share/dotnet/bin/corehost", ["/usr/share/dotnet/bin/corehost", "/usr/share/dotnet/bin/fsc.exe", "-d:DEBUG", "-d:TRACE", "-d:DNXCORE50", "--target:exe", "--noframework", "--nologo", "--simpleresolution", "--debug-", "/tmp/fsharp/obj/Debug/dnxcore50/"..., "--out:/tmp/fsharp/bin/Debug/dnxc"..., "--targetprofile:netcore", "-r:/home/zpodlovics/.nuget/packa"..., "-r:/home/zpodlovics/.nuget/packa"..., "-r:/home/zpodlovics/.nuget/packa"..., ...], [/* 62 vars */] <unfinished ...>
10405 lstat("/usr/share/dotnet/bin/fsc.exe", {st_mode=S_IFREG|0644, st_size=9216, ...}) = 0
10405 lstat("/usr/share/dotnet/bin/fsi.exe", {st_mode=S_IFREG|0644, st_size=299008, ...}) = 0
10405 lstat("/usr/share/dotnet/bin/fsc.exe", {st_mode=S_IFREG|0644, st_size=9216, ...}) = 0
10405 stat("/usr/share/dotnet/bin/fsc.exe", {st_mode=S_IFREG|0644, st_size=9216, ...}) = 0
10405 open("/usr/share/dotnet/bin/fsc.exe", O_RDONLY) = 38

Maybe I miss something coreclr specific arguments but a simple:

/usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

will fail with:

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

I have found the same error here (compiler fsharp.core resolution):
https://github.com/Microsoft/visualfsharp/pull/849

Having the same issues on OSX and tried this on docker which is essentially running Ubuntu. When trying to run fsc.exe getting the "error FS0193... KeyNotFoundException" that is mentioned above. Any luck @enricosada?

No workaround sry

about KeyNotFound you need to pass a FSharp.Core assembly and use

``
--noframework
--simpleresolution


can you try to run the 

`/usr/share/dotnet/bin/corehost "/usr/share/dotnet/bin/fsc.exe" "args"` and args are all arguments inside `obj\Debug\dnxcore50\dotnet-compile-fsc.rsp`?

Atm you cannot do 

`/usr/share/dotnet/bin/corehost "/usr/share/dotnet/bin/fsc.exe" "@obj\Debug\dnxcore50\dotnet-compile-fsc.rsp"`

because the fsc bundled it's old, i am going to send a pr soon about that

I tried to run /usr/share/dotnet/bin/corehost "/usr/share/dotnet/bin/fsc.exe" "args" where args are all arguments inside obj\Debug\dnxcore50\dotnet-compile-fsc.rsp. I got the same error: Access to the path '/usr/local/share/dotnet/bin/' is denied.

@enricosada Putting 2 and 2 together, this means this issue is an F# compiler bug, not a dotnet CLI bug. @KevinRansom will help look into this today.

About osx:

the development version of fsc works, just replace the binaries.
I added a workaround and a zip with the built development version in https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Status

travisci osx should work too (check https://github.com/enricosada/fsharp-dotnet-cli-samples/blob/master/.travis.yml )

About ubuntu: doing it atm, i'll update soon (should be the same issue)

Enrico, I pushed an updated version of the compiler to myget, you might want to update .net cli to use it.

https://www.myget.org/feed/Packages/fsharp-daily

From: Enrico Sada [mailto:[email protected]]
Sent: Monday, March 7, 2016 9:04 AM
To: dotnet/cli [email protected]
Cc: Kevin Ransom Kevin.[email protected]
Subject: Re: [cli] DotNet Run for F# on OS X giving access error (#1405)

About osx:

the development version of fsc works, just replace the binaries.
I added a workaround and a zip with the built development version in https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Status

travisci osx should work too (check https://github.com/enricosada/fsharp-dotnet-cli-samples/blob/master/.travis.yml )

About ubuntu: doing it atm, i'll update soon (should be the same issue)

—
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/cli/issues/1405#issuecomment-193346830.

I am able to reproduce this error when I use the latest official docker image.
https://dotnet.github.io/getting-started/
https://hub.docker.com/r/microsoft/dotnet/

Camerons-iMac:m cameron$ docker images
REPOSITORY                        TAG                 IMAGE ID            CREATED             SIZE
microsoft/dotnet                  latest              38351e1dc672        3 days ago          849.4 MB

Camerons-iMac:m cameron$ docker run --rm -it microsoft/dotnet:latest
root@f4e655f086d0:/# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

It looks like the version being used is 1.0.0-alpha-151221 based on this:

root@f4e655f086d0:~# dotnet new -l F#
Created new F# project in /root.
root@f4e655f086d0:~# cat project.json 
{
    "version": "1.0.0-*",
    "compilationOptions": {
        "emitEntryPoint": true
    },

    "compilerName": "fsc",
    "compileFiles": [
        "Program.fs"
    ],

    "dependencies": {
        "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
        "NETStandard.Library": "1.0.0-rc2-23811"
    },

    "frameworks": {
        "dnxcore50": { }
    }
}

Let's test that theory by overwriting the F# binaries with ones downloaded from MyGet for that specific version.

cd ~
apt-get install unzip

version=1.0.0-alpha-151221

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin

Yes, same error.

root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive:  Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-151221.nupkg
  inflating: /usr/share/dotnet/bin/fsc.exe  
  inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll  
  inflating: /usr/share/dotnet/bin/fsi.exe  
  inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll  
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive:  Microsoft.FSharp.Core.netcore.1.0.0-alpha-151221.nupkg
  inflating: /usr/share/dotnet/bin/FSharp.Core.dll  
  inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata  
  inflating: /usr/share/dotnet/bin/FSharp.Core.optdata  
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

If I try the builds posted yesterday, I get a different error.

version=1.0.0-alpha-160317

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive:  Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-160317.nupkg
  inflating: /usr/share/dotnet/bin/fsc.exe  
  inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll  
  inflating: /usr/share/dotnet/bin/fsi.exe  
  inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll  
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive:  Microsoft.FSharp.Core.netcore.1.0.0-alpha-160317.nupkg
  inflating: /usr/share/dotnet/bin/FSharp.Core.dll  
  inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata  
  inflating: /usr/share/dotnet/bin/FSharp.Core.optdata  
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: The type initializer for '<StartupCode$FSharp-Compiler>.$Reshapedmsbuild' threw an exception.

It is a different FS0193 internal error this time, but no idea what it means. Any ideas?

That exception used to happen coercer build when no assemblies are passed on the command line. That build is from December last year, there are later builds on myget that can be used.

From: Cameron Taggart <[email protected]notifications@github.com>
Reply-To: dotnet/cli <[email protected]reply@reply.github.com>
Date: Saturday, March 19, 2016 at 7:44 PM
To: dotnet/cli <[email protected]cli@noreply.github.com>
Cc: Kevin Ransom [email protected]Kevin.Ransom@microsoft.com>
Subject: Re: [cli] DotNet Run for F# on OS X giving access error (#1405)

I am able to reproduce this error when I use the latest official docker image.
https://dotnet.github.io/getting-started/https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fdotnet.github.io%2fgetting-started%2f&data=01%7c01%7cKevin.Ransom%40microsoft.com%7c2258d1232e9d4107125c08d350699ffe%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=g07wwDLH9fXyqolqAVfftTPBQhBdqAsw%2fUIg9IiqtJc%3d
https://hub.docker.com/r/microsoft/dotnet/https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fhub.docker.com%2fr%2fmicrosoft%2fdotnet%2f&data=01%7c01%7cKevin.Ransom%40microsoft.com%7c2258d1232e9d4107125c08d350699ffe%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=LXFjxHUHkqFLvY8QiggJOoRGvavruur3Iw4%2bpz4qdrc%3d

Camerons-iMac:m cameron$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
microsoft/dotnet latest 38351e1dc672 3 days ago 849.4 MB

Camerons-iMac:m cameron$ docker run --rm -it microsoft/dotnet:latest
root@f4e655f086d0:/# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

It looks like the version being used is 1.0.0-alpha-151221 based on this:

root@f4e655f086d0:~# dotnet new -l F#
Created new F# project in /root.
root@f4e655f086d0:~# cat project.json
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},

"compilerName": "fsc",
"compileFiles": [
    "Program.fs"
],

"dependencies": {
    "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
    "NETStandard.Library": "1.0.0-rc2-23811"
},

"frameworks": {
    "dnxcore50": { }
}

}

Let's test that theory by overwriting the F# binaries with ones downloaded from MyGet for that specific version.

cd ~
apt-get install unzip

version=1.0.0-alpha-151221

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin

Yes, same error.

root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-151221.nupkg
inflating: /usr/share/dotnet/bin/fsc.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll
inflating: /usr/share/dotnet/bin/fsi.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Core.netcore.1.0.0-alpha-151221.nupkg
inflating: /usr/share/dotnet/bin/FSharp.Core.dll
inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata
inflating: /usr/share/dotnet/bin/FSharp.Core.optdata
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

If I try the build posted yesterday, I get a different error.

version=1.0.0-alpha-160317

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin

root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-160317.nupkg
inflating: /usr/share/dotnet/bin/fsc.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll
inflating: /usr/share/dotnet/bin/fsi.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Core.netcore.1.0.0-alpha-160317.nupkg
inflating: /usr/share/dotnet/bin/FSharp.Core.dll
inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata
inflating: /usr/share/dotnet/bin/FSharp.Core.optdata
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: The type initializer for '.$Reshapedmsbuild' threw an exception.

It is a different FS0193 internal error this time, but no idea what it means. Any ideas?

—
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/cli/issues/1405#issuecomment-198834915

@kevinransom, I know. Keep scrolling. :-) I tried the latest builds and get a different error about $Reshapedmsbuild.

I got some iffy advice on Thursday … that installer had the sigfile, opt file and win10manifest file in lib. Publish does not put them in the right place.

So I just did this on my mac:

  1. Install dotnet cli from here: https://github.com/dotnet/cli

Used this project.json to publish the compiler somewhere usable …

{
"dependencies": {
"Microsoft.FSharp.Compiler.Host.netcore": "1.0.0-alpha-160318",
"NETStandard.Library": "1.5.0-rc2-23911"
},
"runtimes": {
"win7-x86": { },
"win7-x64": { },
"osx.10.11-x64": { },
"ubuntu.14.04-x64": { }
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net45+win8"
}
}
}

Ran these commands:

ulimit -n 2048

dotnet restore --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --source https://www.myget.org/F/dotnet-core/api/v3/index.json --source https://www.myget.org/F/fsharp-daily/api/v3/index.json --source https://api.nuget.org/v3/index.json --source https://www.nuget.org/api/v2/

dotnet publish -o compiler

cd compiler

corehost fsc.exe

tmp/foo/compiler > corehost fsc.exe --simpleresolution --noframework --targetprofile:netcore /r:System.Runtime.dll /r:System.IO.dll program.fs /r:FSharp.Core.dll /r:mscorlib.ni.dll

Microsoft (R) F# Compiler version (private)

Copyright (c) Microsoft Corporation. All Rights Reserved.

/tmp/foo/compiler > corehost program.exe

Hello, MacBook!

/tmp/foo/compiler >

So … the dependencies specified in the nuspec are really important, at least while we are in this development phase … pubic apis are changing all of the time, mostly more are added of course.

dotnet restore and
dot net publish
are the correct way to get the program deployed for now..

I am sorry for how crappy the command line experience is right now. It’s something I have to work on — soon. At the moment dotnetcli and project.json is the best way to use f#.

Let me know if this works for you

Kevin

From: Cameron Taggart <[email protected]notifications@github.com>
Reply-To: dotnet/cli <[email protected]reply@reply.github.com>
Date: Saturday, March 19, 2016 at 7:44 PM
To: dotnet/cli <[email protected]cli@noreply.github.com>
Cc: Kevin Ransom [email protected]Kevin.Ransom@microsoft.com>
Subject: Re: [cli] DotNet Run for F# on OS X giving access error (#1405)

I am able to reproduce this error when I use the latest official docker image.
https://dotnet.github.io/getting-started/https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fdotnet.github.io%2fgetting-started%2f&data=01%7c01%7cKevin.Ransom%40microsoft.com%7c2258d1232e9d4107125c08d350699ffe%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=g07wwDLH9fXyqolqAVfftTPBQhBdqAsw%2fUIg9IiqtJc%3d
https://hub.docker.com/r/microsoft/dotnet/https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fhub.docker.com%2fr%2fmicrosoft%2fdotnet%2f&data=01%7c01%7cKevin.Ransom%40microsoft.com%7c2258d1232e9d4107125c08d350699ffe%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=LXFjxHUHkqFLvY8QiggJOoRGvavruur3Iw4%2bpz4qdrc%3d

Camerons-iMac:m cameron$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
microsoft/dotnet latest 38351e1dc672 3 days ago 849.4 MB

Camerons-iMac:m cameron$ docker run --rm -it microsoft/dotnet:latest
root@f4e655f086d0:/# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

It looks like the version being used is 1.0.0-alpha-151221 based on this:

root@f4e655f086d0:~# dotnet new -l F#
Created new F# project in /root.
root@f4e655f086d0:~# cat project.json
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},

"compilerName": "fsc",
"compileFiles": [
    "Program.fs"
],

"dependencies": {
    "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
    "NETStandard.Library": "1.0.0-rc2-23811"
},

"frameworks": {
    "dnxcore50": { }
}

}

Let's test that theory by overwriting the F# binaries with ones downloaded from MyGet for that specific version.

cd ~
apt-get install unzip

version=1.0.0-alpha-151221

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin

Yes, same error.

root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg runtimes/any/native/fsc.exe runtimes/any/native/FSharp.Compiler.dll runtimes/any/native/fsi.exe runtimes/any/native/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-151221.nupkg
inflating: /usr/share/dotnet/bin/fsc.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll
inflating: /usr/share/dotnet/bin/fsi.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll lib/DNXCore50/FSharp.Core.sigdata lib/DNXCore50/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Core.netcore.1.0.0-alpha-151221.nupkg
inflating: /usr/share/dotnet/bin/FSharp.Core.dll
inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata
inflating: /usr/share/dotnet/bin/FSharp.Core.optdata
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.

If I try the build posted yesterday, I get a different error.

version=1.0.0-alpha-160317

curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Compiler.netcore/$version -o Microsoft.FSharp.Compiler.netcore.$version.nupkg
curl -L https://www.myget.org/F/fsharp-daily/api/v2/package/Microsoft.FSharp.Core.netcore/$version -o Microsoft.FSharp.Core.netcore.$version.nupkg

unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin

root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Compiler.netcore.$version.nupkg lib/DNXCore50/fsc.exe lib/DNXCore50/FSharp.Compiler.dll lib/DNXCore50/fsi.exe lib/DNXCore50/FSharp.Compiler.Interactive.Settings.dll -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Compiler.netcore.1.0.0-alpha-160317.nupkg
inflating: /usr/share/dotnet/bin/fsc.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.dll
inflating: /usr/share/dotnet/bin/fsi.exe
inflating: /usr/share/dotnet/bin/FSharp.Compiler.Interactive.Settings.dll
root@f4e655f086d0:~# unzip -jo Microsoft.FSharp.Core.netcore.$version.nupkg lib/DNXCore50/FSharp.Core.dll runtimes/any/native/FSharp.Core.sigdata runtimes/any/native/FSharp.Core.optdata -d /usr/share/dotnet/bin
Archive: Microsoft.FSharp.Core.netcore.1.0.0-alpha-160317.nupkg
inflating: /usr/share/dotnet/bin/FSharp.Core.dll
inflating: /usr/share/dotnet/bin/FSharp.Core.sigdata
inflating: /usr/share/dotnet/bin/FSharp.Core.optdata
root@f4e655f086d0:~# /usr/share/dotnet/bin/corehost /usr/share/dotnet/bin/fsc.exe

error FS0193: internal error: The type initializer for '.$Reshapedmsbuild' threw an exception.

It is a different FS0193 internal error this time, but no idea what it means. Any ideas?

—
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/cli/issues/1405#issuecomment-198834915

Thanks @KevinRansom. I created a 1.0.0-alpha-160318 docker image with the latest dotnet-cli version. I also tagged it as latest, so you can run it like so:

Camerons-iMac:visualfsharp-docker cameron$ docker run --rm -it ctaggart/visualfsharp
root@19d310a03e86:~# dotnet 
.NET Command Line Tools (1.0.0-dev-001806)
Usage: dotnet mmon-options] mmand] guments]

Arguments:
  mmand]     The command to execute
  guments]   Arguments to pass to the command

Common Options (passed before the command):
  -v|--verbose  Enable verbose output
  --version     Display .NET CLI Version Info

Common Commands:
  new           Initialize a basic .NET project
  restore       Restore dependencies specified in the .NET project
  build         Builds a .NET project
  publish       Publishes a .NET project for deployment (including the runtime)
  run           Compiles and immediately executes a .NET project
  repl          Launch an interactive session (read, eval, print, loop)
  pack          Creates a NuGet package
root@19d310a03e86:~# fsc          
Microsoft (R) F# Compiler version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.

error FS0207: No inputs specified
root@19d310a03e86:~# fsi

Microsoft (R) F# Interactive version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> 

error FS0078: Unable to find the file 'System.dll' in any of
 \Reference Assemblies\Microsoft\Framework\.NETFramework/v4.0
 /root
 /usr/share/dotnet/bin
root@19d310a03e86:~# 

Any idea why fsi is giving that error?

Nice, thanks

From: Cameron Taggart <[email protected]notifications@github.com>
Reply-To: dotnet/cli <[email protected]reply@reply.github.com>
Date: Sunday, March 20, 2016 at 2:32 PM
To: dotnet/cli <[email protected]cli@noreply.github.com>
Cc: Kevin Ransom [email protected]Kevin.Ransom@microsoft.com>
Subject: Re: [cli] DotNet Run for F# on OS X giving access error (#1405)

Thanks @KevinRansomhttps://github.com/KevinRansom. I created a 1.0.0-alpha-160318 docker image the latest dotnet-cli version. I also tagged it as latest, so you can run it like so:

Camerons-iMac:visualfsharp-docker cameron$ docker run --rm -it ctaggart/visualfsharp
root@19d310a03e86:~# dotnet
.NET Command Line Tools (1.0.0-dev-001806)
Usage: dotnet mmon-options] mmand] guments]

Arguments:
mmand] The command to execute
guments] Arguments to pass to the command

Common Options (passed before the command):
-v|--verbose Enable verbose output
--version Display .NET CLI Version Info

Common Commands:
new Initialize a basic .NET project
restore Restore dependencies specified in the .NET project
build Builds a .NET project
publish Publishes a .NET project for deployment (including the runtime)
run Compiles and immediately executes a .NET project
repl Launch an interactive session (read, eval, print, loop)
pack Creates a NuGet package
root@19d310a03e86:~# fsc
Microsoft (R) F# Compiler version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.

error FS0207: No inputs specified
root@19d310a03e86:~# fsi

Microsoft (R) F# Interactive version (private)
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

error FS0078: Unable to find the file 'System.dll' in any of
\Reference Assemblies\Microsoft\Framework.NETFramework/v4.0
/root
/usr/share/dotnet/bin
root@19d310a03e86:~#

Any idea why fsi is giving that error?

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/cli/issues/1405#issuecomment-199030279

To resolve this, the dotnetcli packages just need to update their F# dependencies like I did in the docker image I made over the weekend.
https://github.com/ctaggart/visualfsharp-docker/blob/master/.travis.yml#L16
https://hub.docker.com/r/ctaggart/visualfsharp/

@ctaggart there is pr dotnet/cli#1898 ready to be merged with this and other fixes

Still happens for this version:

$ dotnet --version
...
Product Information:
Version: 1.0.0-beta-001598
Commit Sha: 7582649

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin

$ dotnet run
Compiling arningfor 
NXCore,Version=v5.0
sr/local/share/dotnet/bin/dotnet compile-fsc @./obj/Debug/dnxcore50/dotnet-compile.rsp returned Exit Code 1
./error FS0193: Access to the path '/usr/local/share/dotnet/bin' is denied.

@alexandru you need version 1.0.0-beta-002071, the version 1.0.0-beta-001598 doesnt work xplat, the fix doesnt apply to older version

check https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Status

@enricosada thanks, will try.

Got 1.0.0-beta-002071 and installed by hand on OSX (by copying the contents of the sdk folder in the tgz into /usr/local/share/dotnet/bin) and now I'm getting this: https://github.com/dotnet/cli/issues/1488 -- could it be that I'm missing a step when installing?

Running into the same issue on OS X 10.11.4.

For other people on OS X, you can download from this link:
https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-beta-002071/dotnet-dev-osx-x64.1.0.0-beta-002071.tar.gz

This was a dotnet tool bug, I believe it is fixed in the latest versions of the tools.

I installed latest version (dotnet-dev-osx-x64.1.0.0-preview1-002702.pkg), but still occur.

My environment is OS X 11.4.
I tried,

$ dotnet run
Compiling ppfor 
                NXCore,Version=v5.0
sr/local/share/dotnet/bin/dotnet compile-fsc @/Users/toku/Documents/src/app/obj/Debug/dnxcore50/dotnet-compile.rsp returned Exit Code 1
/Users/toku/Documents/src/app/error FS0193: Access to the path '/usr/local/share/dotnet/bin' is denied.

Compilation failed.
   0 Warning(s)
    1 Error(s)

Time elapsed 00:00:09.2039521

Did anyone succeed?

Sorry, I succeeded!
It was because left the old environment.
% rm -rf /usr/local/share/dotnet
then reinstall latest version, so I succeeded.
Thank you.

Yay, mine works now too with Rc2 and removing the old dotnet!

Was this page helpful?
0 / 5 - 0 ratings