NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

ubuntu 16.04 mono Method 'Array.Empty' not found after nuget 4.5.1 #6790

Closed rgl closed 6 years ago

rgl commented 6 years ago

Details about Problem

NuGet product used NuGet.exe:

https://dist.nuget.org/win-x86-commandline/v4.6.2/nuget.exe https://dist.nuget.org/win-x86-commandline/v4.6.1/nuget.exe

OS version:

Ubuntu 16.04.4 LTS (Xenial Xerus)

Worked before? If so, with which NuGet version:

https://dist.nuget.org/win-x86-commandline/v4.5.1/nuget.exe

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

$ mono --version
Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

$ nuget
Unhandled Exception:
System.MissingMethodException: Method 'Array.Empty' not found.
  at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x415c8270 + 0x000af> in <filename unknown>:0 
  at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x415c8240 + 0x00013> in <filename unknown>:0 
  at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x415c7f30 + 0x00133> in <filename unknown>:0 
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x4159e8f0 + 0x008db> in <filename unknown>:0 
  at NuGet.CommandLine.Program.Main (System.String[] args) <0x4159ad50 + 0x00037> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Array.Empty' not found.
  at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x415c8270 + 0x000af> in <filename unknown>:0 
  at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x415c8240 + 0x00013> in <filename unknown>:0 
  at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x415c7f30 + 0x00133> in <filename unknown>:0 
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x4159e8f0 + 0x008db> in <filename unknown>:0 
  at NuGet.CommandLine.Program.Main (System.String[] args) <0x4159ad50 + 0x00037> in <filename unknown>:0 
rohit21agrawal commented 6 years ago

@rgl could you try this with the latest stable mono version?

ragrawal@ragrawalwork:/mnt/e/DevTools/nuget462$ mono --version
Mono JIT compiler version 5.10.1.20 (tarball Thu Mar 29 10:44:58 UTC 2018)

I tried nuget.exe from 4.5.1 to 4.6.2 and they seem to work with that mono version.

knocte commented 6 years ago

I'm affected by this as well.

@rohit21agrawal actually, latest stable mono version is 5.8.1.0 IMO, because it's what gets pulled from VS4Mac in the stable channel.

FYI, in Mac platform with 5.8.1.0, this Nuget4.6.x bug doesn't occur.

However, IMO the "stable version" argument here is moot, because the most stable is "LTS stable", which is what Ubuntu 16.04 brings by default. Making Nuget still be compatible with Mono's LTS stable should be important.

rgl commented 6 years ago

@rohit21agrawal it works after upgrading mono.

rohit21agrawal commented 6 years ago

reactivating as we need to have a discussion on nuget.exe compatibility with mono, and what our approach should be moving forward.

mhutch commented 6 years ago

@knocte is there a specific scenario that's important to you? Why would you need to update NuGet but be unable to update Mono?

knocte commented 6 years ago

@mhutch that's certainly a good question! The reason is that the majority of nuget packages nowadays expose a bug in the nuget version shipped with Ubuntu 16.04. For example, the NBitcoin package, if you try to add it, you get the error: "'NBitcoin' already has a dependency defined for 'Newtonsoft.Json'" (more info in stackoverflow: https://stackoverflow.com/questions/25725545/nuget-x-already-has-a-dependency-defined-for-y ). Therefore I was forced to download a newer version of nuget to avoid this.

Now, if the new versions of nuget are also incompatible with latest UbuntuLTS's mono, using nuget in this distro becomes such a game of sorcery, to get the adequate (not too new, not too old) version of nuget...

knocte commented 6 years ago

And forgot to mention: my open source project runs ok with the version of Mono shipped with UbuntuLTS, therefore, I'm trying my best not to require anyone (i.e. potential contributors) to download/upgrade to a new Mono, just to be able to build the project themselves. If at build time I can download a version of nuget that at least doesn't have bugs, that's better than having to download the whole mono-complete set of packages.

mhutch commented 6 years ago

Okay, so it sounds like it's a workaround for a specific bug, rather than a more general use case

Presumably this will no longer be an issue in a couple weeks when 18.04 comes out?

knocte commented 6 years ago

Presumably this will no longer be an issue in a couple weeks when 18.04 comes out?

TBH I'm not sure. I think Mono's version in 18.04 is not much higher (4.6 I think, which doesn't even bring BoringTLS), and I don't know if any packager has cared about updating the version of nuget.

directhex commented 6 years ago

NuGet 3.0+ can't build 100% from source with Mono, so isn't eligible for updating in Debian/Ubuntu. There's newer in the mono-project packages.

Mono updating in Debian/Ubuntu is blocked on https://github.com/mono/mono/issues/7445

whereisaaron commented 6 years ago

Similar issue on Debian 8. The nuget.exe 4.5.1 binary does run with Debian 8 mono, however newer versions of nuget.exe fail with 'System.Array.Empty not found'.

mishra14 commented 6 years ago

@mhutch has this been fixed from your end?

mhutch commented 6 years ago

@mishra14 it was fixed in Mono long ago and packages for the updated Mono are available.

This affects folks who want to use a recent NuGet on the in-box version of Mono on Ubuntu 16.0.4 LTS, but I'm not sure whether that's an important scenario to support.