title: How can I diagnose missing dependencies (or other loader failures) in dnx?
body: <p>I'm trying to run a modified version of the <a href="https://github.com/aspnet/Home/tree/master/samples/HelloWeb" rel="noreferrer">HelloWeb sample</a> for ASP.NET vNext on DNX using Kestrel. I understand that this is <em>very</em> much on the bleeding edge, but I would hope that the ASP.NET team would at least keep the simplest possible web app working :)</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>Linux (Ubuntu, pretty much)</li>
  <li>Mono 3.12.1</li>
  <li>DNX 1.0.0-beta4-11257 (I have 11249 available too)</li>
  </ul>
  
  <p>"Web app" code, in <code>Startup.cs</code>:</p>
  
  <pre><code>using Microsoft.AspNet.Builder;
  public class Startup
  {
      public void Configure(IApplicationBuilder app)
      {
          app.UseWelcomePage();
      }
  }
  </code></pre>
  
  <p>Project config, in <code>project.json</code>:</p>
  
  <pre><code>{
    "dependencies": {
      "Kestrel": "1.0.0-beta4",
      "Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
      "Microsoft.AspNet.Hosting": "1.0.0-beta4",
      "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
      "Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
      "Microsoft.Framework.Runtime": "1.0.0-beta4",
      "Microsoft.Framework.Runtime.Common": "1.0.0-beta4",
      "Microsoft.Framework.Runtime.Loader": "1.0.0-beta4",
      "Microsoft.Framework.Runtime.Interfaces": "1.0.0-beta4",
    },
    "commands": {
      "kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
    },
    "frameworks": {
      "dnx451": {}
    }
  }
  </code></pre>
  
  <p><code>kpm restore</code> appears to work fine.</p>
  
  <p>When I try to run, however, I get an exception suggesting that <code>Microsoft.Framework.Runtime.IApplicationEnvironment</code> can't be found. Command line and error (somewhat reformatted)</p>
  
  <pre><code>.../HelloWeb$ dnx . kestrel
  System.IO.FileNotFoundException: Could not load file or assembly 
  'Microsoft.Framework.Runtime.IApplicationEnvironment,
    Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
  or one of its dependencies.
  File name: 'Microsoft.Framework.Runtime.IApplicationEnvironment,
    Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke 
      (System.Reflection.MonoMethod,object,object[],System.Exception&amp;)
    at System.Reflection.MonoMethod.Invoke 
      (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder,
       System.Object[] parameters, System.Globalization.CultureInfo culture)
      [0x00000] in &lt;filename unknown&gt;:0
  </code></pre>
  
  <p>While obviously, my most pressing need is to fix this, I'd also appreciate advice on how to move to diagnose what's going wrong so I can fix similar issues myself in the future. (That's also likely to make this question more useful to others, too.)</p>
  
  <p>I've found <code>Microsoft.Framework.Runtime.IApplicationEnvironment</code> in the <a href="https://github.com/aspnet/DNX/blob/dev/src/Microsoft.Framework.Runtime.Interfaces/IApplicationEnvironment.cs" rel="noreferrer"><code>Microsoft.Framework.Runtime.Interfaces</code> assembly source</a>, and that doesn't appear to have changed recently. It's not clear why the exception shows the name as if it's a whole assembly in itself, rather than just an interface within another assembly. <strike>I'm guessing this <em>may</em> be due to <a href="https://github.com/aspnet/Home/wiki/Assembly-Neutral-Interfaces" rel="noreferrer">assembly neutral interfaces</a>, but it's not clear from the error.</strike> (<a href="https://github.com/aspnet/DNX/commit/5f8bf5614d04b82dc69aedf48a5b2f832f00ca8f" rel="noreferrer"><code>[AssemblyNeutral]</code> is dead, so that's not it...</a>)</p>