title: Blazor WebAssembly Reflection Missing System.Runtime
body: <p>​I have started to work with Blazor and setup a hosted web-assembly application.</p>
  <p>Within the App.Razor, I am using lazy loaded assemblies which are loaded from an API and then use Reflection to inspect each dll for an implementation of a specific interface.</p>
  <p>This works perfectly fine when running the solution via Visual Studio (debugging). When I publish the solution, I am getting an error when loading the libraries stating System.Runtime 5.0.0.0 is missing.</p>
  <p>This is working whenever it is being started in visual studio but not when running the published code.</p>
  <p>I have tried this using Blazor server and this is working perfectly fine.</p>
  <p>I have tried to work with adding false to see if the problem is caused by the linking but the issue still exists.</p>
  <p>I have tried this on net5, net5.0.1 and net5 RC2.</p>
  <p>Any advice would be much appreciated.</p>
  <p>Thanks in advance​</p>
  <p>The code in my webassembly is:</p>
  <pre class="lang-cs prettyprint-override"><code>private static List&lt;Assembly&gt; LoadedAssemblies { get; set; }
      public static async Task&lt;List&lt;Assembly&gt;&gt; GetAssemblies(HttpClient client)
      {
          if (LoadedAssemblies is null)
          {
              LoadedAssemblies = new List&lt;Assembly&gt;();
              Console.WriteLine($&quot;Running Version: {Runtime.FrameworkDescription}&quot;);
  
              var files = System.Text.Json.JsonSerializer.Deserialize&lt;string[]&gt;(await (await client.GetAsync(&quot;/api/addons&quot;)).Content.ReadAsStringAsync());
  
              Console.WriteLine(string.Join(',', files));
              
              var allAssemblies = new List&lt;Assembly&gt;();
              foreach (string dll in files)
              {
                  var dllData = await client.GetStringAsync(&quot;/api/addons/&quot; + dll);
                  allAssemblies.Add(Assembly.Load(Convert.FromBase64String(dllData)));
              }
  
              LoadedAssemblies = allAssemblies
                  .Where(w =&gt; w.GetTypes().Any(a =&gt; a.GetInterfaces().Contains(typeof(IModule)))).ToList();
          }
  
          return LoadedAssemblies;
      }
  
      public static async Task&lt;IEnumerable&lt;TypeInfo&gt;&gt; GetTypes&lt;T&gt;(HttpClient client)
      {
          return (await GetAssemblies(client)).SelectMany(a =&gt; a.DefinedTypes.Where(x =&gt; x.GetInterfaces().Contains(typeof(T))));
      }
  
      public static async Task&lt;IEnumerable&lt;T&gt;&gt; GetInstances&lt;T&gt;(HttpClient client)
      {
          List&lt;T&gt; instances = new List&lt;T&gt;();
  
          foreach (Type implementation in await GetTypes&lt;T&gt;(client))
          {
              if (!implementation.GetTypeInfo().IsAbstract)
              {
                  T instance = (T)Activator.CreateInstance(implementation);
                  instances.Add(instance);
              }
          }
  
          return instances;
      }
  </code></pre>
  <p>The Chrome error is:</p>
  <pre><code>Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
        Unhandled exception rendering component: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  IO_FileName_Name, System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
     at System.Reflection.RuntimeModule.GetTypes()
     at System.Reflection.Assembly.GetTypes()
     at AssemblyScanning.&lt;&gt;c.&lt;GetAssemblies&gt;b__4_0(Assembly w)
     at System.Linq.Enumerable.WhereListIterator`1[[System.Reflection.Assembly, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToList()
     at System.Linq.Enumerable.ToList[Assembly](IEnumerable`1 source)
     at AssemblyScanning.GetAssemblies(HttpClient client)
     at Dash.WMS.WebClient.Client.App.OnNavigateAsync(NavigationContext args)
     at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
     at Microsoft.AspNetCore.Components.Routing.Router.RunOnNavigateAsync(String path, Boolean isNavigationIntercepted)
     at Microsoft.AspNetCore.Components.Routing.Router.&lt;&gt;c__DisplayClass61_0.&lt;RunOnNavigateAsync&gt;b__1(RenderTreeBuilder builder)
     at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
     at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
     at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
  </code></pre>