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

Minimal console app unhandled FileNotFoundException #291

Closed
mikehaas763 opened this issue Nov 22, 2015 · 47 comments

Comments

@mikehaas763
Copy link

commented Nov 22, 2015

I installed the mac osx pkg installer from get.asp.net. I then created a very minimal hello world console app. I've ran dotnet restore which appears to have run successfully. Then when I run dotnet run I get this:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

@mikehaas763

This comment has been minimized.

Copy link
Author

commented Nov 22, 2015

project.json:

{
    "version": "1.0.0-*",
    "compilationOptions": {
        "emitEntryPoint": true
    },

    "dependencies": {
        "System.Console": "4.0.0-beta-*",
        "System.Runtime": "4.0.21-beta-*"
    },

    "frameworks": {
        "dnxcore50": { }
    }
}
@adrian17

This comment has been minimized.

Copy link

commented Nov 22, 2015

Same issue on Debian, both Jessie and Stretch (future release).

Edit: apparently the docs are out of date?

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Nov 22, 2015

The docs are now updated as well as the samples. Confirmed that new project.json make the samples work on Ubuntu and Windows. However, OS X still fails (El Capitan, 10.11.1) with the above issue.

Also see dotnet/core#26.

/cc @davidfowl @piotrpMSFT @brthor

@TheRealPiotrP

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2015

@mikehaas, can you confirm @blackdwarf updates and let us know if this can be closed?

@mikehaas763

This comment has been minimized.

Copy link
Author

commented Nov 23, 2015

@blackdwarf what are the doc updates you've made? Is it the change from manually creating a project.json file to just using dotnet init ?

@dlech

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2015

Here are the changes: dotnet/core@c611772

@mikehaas763

This comment has been minimized.

Copy link
Author

commented Nov 23, 2015

@dlech thanks for pointing me to the change

@piotrpMSFT Yes I confirm that the docs were updated, but do you really want to have this bug closed before it's fixed when it's being referenced in the Beta-Jan milestone?

@jgowdy

This comment has been minimized.

Copy link

commented Nov 23, 2015

Still seems broken:

user@host:~/hello$ dotnet run

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

user@host:~/hello$ cat project.json
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},

"dependencies": {
    "Microsoft.NETCore.Runtime": "1.0.1-beta-*",
    "System.IO": "4.0.11-beta-23516",
    "System.Console": "4.0.0-beta-*",
    "System.Runtime": "4.0.21-beta-*"
},

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

}

user@host:~/hello$ cat /etc/issue
Ubuntu 15.04 \n \l

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2015

Is this on os x @jgowdy?

@jgowdy

This comment has been minimized.

Copy link

commented Nov 23, 2015

Ubuntu 15.04

@jgowdy

This comment has been minimized.

Copy link

commented Nov 24, 2015

I just reinstalled with Ubuntu 14.04 LTS and can no longer reproduce the problem after changing System.IO to "4.0.11-beta-*" Specifically targeting 23516 wasn't needed.

Edit: Reinstalled 15.04 from scratch, problem exists. Can't be related to previous installs.

So Ubuntu 14.04 LTS works, 15.04 installs but fails to run with:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

and 15.10 won't install at all due to the dependency issue I reported here:

#308

@jgowdy

This comment has been minimized.

Copy link

commented Nov 24, 2015

OSX 10.11.1 El Capitan:

Jeremiahs-MacBook-Pro:hello jgowdy$ dotnet run

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

@TheRealPiotrP

This comment has been minimized.

Copy link
Contributor

commented Nov 24, 2015

Ok, yea, we will take a look.

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Nov 25, 2015

This is all due to our extremely minimal support of RIDs (see https://github.com/dotnet/cli/blob/master/src/Microsoft.DotNet.ProjectModel/RuntimeIdentifier.cs and https://github.com/dotnet/cli/blob/master/scripts/_common.sh#L68)

We need to port the runtime identification code DNX has over, but that was heavily P/Invoke dependent. We are hoping to get an API in CoreFX we can use (#185 (comment))

/cc @davidfowl

@adrian17

This comment has been minimized.

Copy link

commented Nov 28, 2015

For impatient Ubuntu non-LTS users, there is an ugly unsafe temporary workaround: edit /etc/os-release and change the following values:

ID=ubuntu
VERSION_ID="14.04"

Then rerun dotnet restore (remember to change os-release back to its original version immediately afterwards!). After this, dotnet run properly runs a minimal console application. I tested it on Ubuntu 15.10, 15.04 and Debian.

@TomPoulton

This comment has been minimized.

Copy link

commented Dec 10, 2015

I'm seeing this on Mac OSX as well (El Capitan 10.11.1)

$ dotnet init
Created new project in /Users/... etc ...
$ ls
Program.cs  project.json
$ dotnet restore
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16048

  CACHE https://www.myget.org/F/aspnetvnext/api/v2/
  CACHE https://www.nuget.org/api/v2/
Restoring packages for /Users/tom/... etc ...
... etc ...
$ dotnet run

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
@davidfowl

This comment has been minimized.

Copy link
Collaborator

commented Dec 10, 2015

Yes El Capitan restore is broken. To work around it you have to do dotnet restore --runtime osx.10.10-x64

@davidfowl

This comment has been minimized.

Copy link
Collaborator

commented Dec 10, 2015

@anurse We need to fix this.

@TomPoulton

This comment has been minimized.

Copy link

commented Dec 10, 2015

I think you meant dotnet restore --runtime osx.10.10-x64 ;) but yes that worked!

@rogah

This comment has been minimized.

Copy link

commented Dec 11, 2015

El Capitan (10.11.1) restore is broken. The work around worked for now but it's frustrating though.

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Dec 11, 2015

I'm actively working on improving the OS detection by porting some DNX code. Probably not going to be fully integrated until early next week, but it's on the way :).

@jgowdy

This comment has been minimized.

Copy link

commented Dec 11, 2015

@anurse Excellent, thank you.

@brthor

This comment has been minimized.

Copy link
Contributor

commented Dec 11, 2015

@anurse Nice! 😄 We need that

@TomPoulton

This comment has been minimized.

Copy link

commented Dec 11, 2015

This is such a surreal experience, conversing with Microsoft on GitHub about a .NET bug on Mac OSX! Love it :)
Thanks for the quick turnaround @anurse

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Dec 15, 2015

@anurse is this the same as #498? Should we close this one?

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Dec 15, 2015

Kinda. They both refer to the same problem: We need accurate RID detection. Neither really captures that fully. Maybe create a new bug with that and dupe these to that bug.

@ochowie

This comment has been minimized.

Copy link

commented Dec 16, 2015

@anurse Will this fix the issue on Ubuntu 15.04. I can confirm that the temporary fix @adrian17 proposed works but it's really not a sustainable solution.

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Dec 16, 2015

It should

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2015

@anurse is the change you mention above done?

@VivekRagunathan

This comment has been minimized.

Copy link

commented Dec 25, 2015

Same error here on my mac:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I tried setting this: DOTNET_HOME=/usr/local/share/dotnet/ too as suggested in one of the forums.

No solution yet? Any workarounds?

@dlech

This comment has been minimized.

Copy link
Contributor

commented Dec 25, 2015

Please read/search the previous comments. Someone is working on it, but it is not fixed yet. There are several workarounds that have been mentioned, including one for El Capitan.

@VivekRagunathan

This comment has been minimized.

Copy link

commented Dec 26, 2015

Yes I already did. I am running on OSX 10.11.2, and the dotnet restore --runtime osx.10.10-x64 does not work its magic. I guess I will have to wait for the real fix.

@dlech

This comment has been minimized.

Copy link
Contributor

commented Dec 26, 2015

FWIW, I just updated to OS X 10.11.2 and dotnet restore --runtime osx.10.10-x64 still works for me.

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Dec 27, 2015

The pre-requisite change in the PlatformAbstractions library is done, but I wasn't able to get the necessary changes made to dotnet-cli before leaving for the holidays.

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2015

@anurse thanks for the update! :)

@simranjitr

This comment has been minimized.

Copy link

commented Dec 31, 2015

I did the following (on OSX 10.11.2) to get the basic 'dotnet new' generated program up and running:

##########
export DOTNET_HOME=/usr/local/share/dotnet/
##########

###project.json####

{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},

"dependencies": {
    "System.Console": "4.0.0-beta-*", 
    "System.IO": "4.0.11-beta-*",
    "System.Runtime": "4.0.21-beta-*" 
},

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

}

$dotnet restore --runtime osx.10.10-x64
$dotnet run

which worked.

Specifying --runtime osx.10.11-x64, fails with 'Could not load assembly System.Console 4.0.0.0' error.

@anurse

This comment has been minimized.

Copy link
Collaborator

commented Jan 3, 2016

Yeah, that's because dotnet-restore knows about osx.10.11 and so it puts that in the lock file, but dotnet-run does not, so it's looking for osx.10.10 :). It's exactly the issue I'm working on resolving in #498

@blackdwarf blackdwarf assigned anurse and unassigned blackdwarf Jan 7, 2016
@anurse

This comment has been minimized.

Copy link
Collaborator

commented Jan 7, 2016

Should be fixed when #498 is closed. If not, please feel free to reopen!

@loic-sharma

This comment has been minimized.

Copy link
Member

commented Apr 12, 2016

Hey, seems like this bug is back:

$ dotnet new
Created new project in  /Users/sharmaloic/Code/REPL
$ dotnet restore
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16231

  CACHE https://api.nuget.org/v3/index.json
Restoring packages for /Users/sharmaloic/Code/REPL/project.json
  GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.runtime/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.io/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.console/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.runtime/index.json
  OK https://api.nuget.org/v3-flatcontainer/system.io/index.json 300ms
  OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.runtime/index.json 525ms
  OK https://api.nuget.org/v3-flatcontainer/system.console/index.json 387ms
  OK https://api.nuget.org/v3-flatcontainer/system.runtime/index.json 433ms
Writing lock file /Users/sharmaloic/Code/REPL/project.lock.json
Restore complete, 7195ms elapsed

NuGet Config files used:
    /Users/sharmaloic/.config/NuGet/nuget.config

Feeds used:
    https://api.nuget.org/v3-flatcontainer/
$ dotnet run

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
$ dotnet build

Unhandled Exception: System.ComponentModel.Win32Exception: No such file or directory
   at System.Diagnostics.Process.ResolvePath(String filename)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at Microsoft.DotNet.Cli.Utils.Command.Execute()
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Abort trap: 6
$ dotnet restore --runtime osx.10.10-x64
   ....
$ dotnet run
Hello World!

I'm on El Capitan 10.11 and freshly installed the .NET Core SDK Installer linked in the readme.

@salvarubiomartinez

This comment has been minimized.

Copy link

commented Apr 16, 2016

Same thing happen to me

@BrendanBuono

This comment has been minimized.

Copy link

commented Jul 10, 2016

Seeing the same with on .NET Core 1.0 Mac OS X

Install via instructions at https://www.microsoft.com/net/core#macos

@VivekRagunathan

This comment has been minimized.

Copy link

commented Jul 10, 2016

Check all dependencies - openssl etc. Also check the restore command for osx . Alternatively you can try the same with vscode to make sure all deps are ok.

@dlech

This comment has been minimized.

Copy link
Contributor

commented Dec 3, 2016

This is still an issue for me on macOS Sierra, following the hello world example from https://www.microsoft.com/net/core#macos.

Following the steps provided in the link, (dotnet new; dotnet restore; dotnet run) I get the exception as described in the first comment of this issue when trying to run with dotnet run. The dotnet restore --runtime osx.10.10-x64 workaround is still required in order to run without throwing an exception.

I assume that I am using the dotnet command from dotnet-dev-osx-x64.1.0.0-preview2-1-003177.pkg that I just installed, but there is no dotnet --version command, so I don't know if I am actually using that version or an old version of dotnet that I installed a year ago.

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2016

@dletch we do have the --version option in the CLI. When you say you don't uave it what do you mean by that?

@dlech

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2016

I'm guessing that I have two versions of dotnet installed, one that I installed a year ago and one that I installed today. I haven't been using it in between. The older version must be in $PATH before the newer version. If I run dotnet --version, I get Unknown option: --version.

So, I'm sure this bug is fixed and I am just seeing it still because I am running a very old dotnet that I need to figure out how to uninstall so that it doesn't get in the way of the current version.

@dlech

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2016

If found this script to uninstall the old version, so I am up and running now.

@blackdwarf

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2016

@dlech good, glad to see you're back on track. :)

wli3 pushed a commit to wli3/cli that referenced this issue Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.