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


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:
  1. Inspect ~/.config/NuGet/NuGet.Config, it should be like this:
.

  
    
    
  
  

  1. 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.)
  2. Clone your sources.
  3. Select a dnx version via dnvm use.
  4. Make sure your user-account-level dnx runtime packages are restored via dnu restore.
  5. ??What??
  6. 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
  1. 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 upgrade without targeting the nightly build server? It looks to me that your code might be using beta8 assemblies on a beta8-15858 runtime.
    Run dnu feeds list on 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 the nuget.config file 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 upgrade
    • dnvm install -r coreclr latest
    • Then run dnu restore on your project
    • dnx web should now work
    2015-11-13 14:11:59
  2. 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;
    1. Installed dnvm and libuv per the instructions here.
    2. Ran dnvm install 1.0.0-beta8
    3. Installed mono-snapshot-latest and executed . mono-snapshot mono
    4. Cloned this new MVC 6 beta8 project git clone https://github.com/staff0rd/TinyMvc -b beta8
    5. Ran mozroots --import --sync so nuget doesn't throw TrustFailure exceptions
    6. Executed cd TinyMvc and dnu restore
    7. 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

Popular posts from this blog

Hey Ram song Akashe Jyotsna meaning