Home

"FileLoadException: Assembly is still being loaded." when running ASP.NET Core in script

edited January 2019
I have a script for running a minimal ASP.NET Core site in LINQPad, which used to work perfectly a few months ago (on a different machine, and probably an older version of LINQPad).

I now get:

Assembly is still being loaded. (Exception from HRESULT: 0x80131016)
  at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.UseIIS(IWebHostBuilder hostBuilder)
   at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(String[] args)
   at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder()
   at UserQuery.Main()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
The script is here: http://share.linqpad.net/s84g2a.linq

It happens in the line: `void Main() => WebHost.CreateDefaultBuilder().UseStartup().Build().Run();`. Any ideas? Thanks!

Comments

  • +1, I have the same issue and have no idea.
  • Do we have any fix/help for this? Very eager to use LINQPad to build a ASP.NET Core application.
  • edited January 2019
    I performed a number of installations today and was able to witness this on one of our machines, but not two others. The only difference I observed is that a machine that had the .NET Core 2.2 preview installed ran into issues. Continuing to test.
  • @sdflysha @mcintyre321 downloading the latest beta resolved this for me. I hope it works for you, too: https://www.linqpad.net/download.aspx#beta
  • I'm having this issue and I *had* 2.2 preview installed at one point -- but uninstalled it -- but the issue won't go away. Rather frustration as I'm stuck on this one.
  • Does it make any difference if you use the AnyCPU version of LINQPad?
  • Also, try running the following query:
    http://share.linqpad.net/ole7mo.linq

    I've added a binding redirect in the app.config (press F4 to see it). The binding redirect shouldn't technically be required, but it appears that something weird is going on in the CLR.
  • Hi Joe, I've installed the latest beta and it's fixed the problem. Thanks!
  • Crazy - it stopped working today, with a slightly different message:
    ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
    and the LoaderExceptions contains:
    Assembly is still being loaded. (Exception from HRESULT: 0x80131016)

    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
    at System.Reflection.Assembly.LoadFrom(String assemblyFile)
    at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
    I've tried downloading an even newer beta, but still getting it
  • Just tried your binding redirect - that fixes it. thanks
Sign In or Register to comment.