DNX on ubuntu 14.04 throws Missing method exception
Error
Missing method System.Runtime.InteropServices.Marshal::GetTypeFromCLSID(Guid) in assembly /usr/lib/mono/4.5/mscorlib.dll, referenced in assembly /home/netdevlinux102/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1/bin/Microsoft.Dnx.Compilation.CSharp.dll
System.MissingMethodException: Method not found: 'System.Runtime.InteropServices.Marshal.GetTypeFromCLSID'.
at System.Lazy`1[System.Boolean].InitValue () [0x00000] in:0 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in:0 
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in:0 
at Microsoft.Dnx.Host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args, IRuntimeEnvironment env, System.String appBase, System.Runtime.Versioning.FrameworkName targetFramework) [0x00000] in:0 
Missing method System.Runtime.InteropServices.Marshal::GetTypeFromCLSID(Guid) in assembly /usr/lib/mono/4.5/mscorlib.dll, referenced in assembly /home/netdevlinux102/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1/bin/Microsoft.Dnx.Compilation.CSharp.dll
System.MissingMethodException: Method not found: 'System.Runtime.InteropServices.Marshal.GetTypeFromCLSID'.
at System.Lazy`1[System.Boolean].InitValue () [0x00000] in
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in
at Microsoft.Dnx.Host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args, IRuntimeEnvironment env, System.String appBase, System.Runtime.Versioning.FrameworkName targetFramework) [0x00000] in
dnvm list
Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
       1.0.0-beta8          mono                 linux/osx
  *    1.0.0-rc1-update1    mono                 linux/osx       default
 dnx --version
Microsoft .NET Execution environment
 Version:      1.0.0-rc1-16231
 Type:         Mono
 Architecture: x64
 OS Name:      Linux
 OS Version:   ubuntu 14.04
 Runtime Id:   ubuntu.14.04-x64
Some general setup steps:
- Inspect ~/.config/NuGet/NuGet.Config, it should be like this:
 
.
  
    
    
     
  
  
- Make sure dnx and dnu and dnvm binaries are present and up to date. Make sure libuv exists and is the correct version. Install runtimes if they are not present. (Check them with dnvm list, use dnvm install to install.)
 - Clone your sources.
 - Select a dnx version via dnvm use.
 - Make sure your user-account-level dnx runtime packages are restored via dnu restore.
 - ??What??
 - Go to folder containing project.json and run
dnx web. Success? 
Update: If I use dnvm use 1.0.0-beta8 on ubuntu 14.04, the dnx web runtime fault may be 
Missing method AllocHGlobal in assembly /home/user/.dnx/runtimes/dnx-mono.1.0.0-beta8/bin/System.Reflection.Metadata.dll, type System.Runtime.InteropServices.Marshal or it may be the System.Runtime.InteropServices.Marshall in the title.
Update2: When I had the wrong contents in NuGet.Config, I was seeing some developer channel (internal unreleased) builds.
Current output of dnvm list:
me@mabox:~$ dnvm list
Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
       1.0.0-beta7          mono                 linux/osx
  *    1.0.0-beta8          mono                 linux/osx       default
Update 3: Once I installed coreclr target runtime type this issue went away. Once it's installed, dnvm list looks like this:
Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
  *    1.0.0-beta8          coreclr x64          linux
       1.0.0-beta8          mono                 linux/osx       default
Update 4: Both answers below contain essential information. One mistake I made was to assume that the ancient mono-2.x versions that are included in the apt-get repos of Ubuntu 14.04 are acceptable for DNX usage. They are not, instead as of the date I am writing this, only recent mono-2015.11.xx nightly builds are known to work. At some point in future once a stable 4.3.0+ version is released, you would be using that, probably, with DNX, but I can't say for sure.
2 Answers
- The latest .Net and Visual Studio tooling on Windows is 1.0.0-beta8, and I have that also on my ubuntu box, which reports that Mono-x64-1.0.0-beta8-15858 is intalled.To me it seems that you are not running against the same runtime.Have you tried running a
dnvm upgradewithout targeting the nightly build server? It looks to me that your code might be usingbeta8assemblies on abeta8-15858runtime.Rundnu feeds liston your Ubuntu box to make sure you are targeting the stable channel and not the developer one (should see only the default feed).If you are targeting the wrong feed, you can change it from thenuget.configfile located in your user folder under~/.config/NuGet/Nuget.Config.Do the following to ensure you are on the proper runtime:- Delete all existing runtimes in 
~/.dnx/runtimes dnvm upgradednvm install -r coreclr latest- Then run 
dnu restoreon your project dnx webshould now work
2015-11-13 14:11:59 - Delete all existing runtimes in 
 - It is possible to run beta8 against mono on ubuntu 14.04. I just gave it a shot and was successful, here's the steps I followed;
- Installed dnvm and libuv per the instructions here.
 - Ran
dnvm install 1.0.0-beta8 - Installed mono-snapshot-latest and executed
. mono-snapshot mono - Cloned this new MVC 6 beta8 project
git clone https://github.com/staff0rd/TinyMvc -b beta8 - Ran
mozroots --import --syncso nuget doesn't throw TrustFailure exceptions - Executed
cd TinyMvcanddnu restore - Run
dnx web; 
Result:[mono-2015.11.13+00.47.00]root@8792d900344b:/TinyMvc# dnx web Hosting environment: Production Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. 
Comments