question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bolero-app template using Bolero.dll (0.15.18) throws could not load Elmish 3.1.0.0 dll exception

See original GitHub issue

I ran the getting started commands with the latest .NET Core SDK installed (3.1.402) on Windows 10:

dotnet new -i Bolero.Templates
dotnet new bolero-app -o MyApp
cd MyApp
dotnet run -p src/MyApp.Server

When I navigate to http://localhost:5000 I get this error in the console window:

PS C:\Users\AdamDavidson\source\repos\MyApp> dotnet run -p src/MyApp.Server
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\AdamDavidson\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Development
Content root path: C:\Users\AdamDavidson\source\repos\MyApp\src\MyApp.Server
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint '/_Host'
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3]
      Route matched with {page = "/_Host"}. Executing page /_Host
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[103]
      Executing an implicit handler method - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[104]
      Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4]
      Executed page /_Host in 21.9843ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint '/_Host'
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HM2Q8PGCGTVF", Request id "0HM2Q8PGCGTVF:00000001": An unhandled exception was thrown by the application.
System.IO.FileLoadException: Could not load file or assembly 'Elmish, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: 'Elmish, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null'
   at MyApp.Server.Pages__Host.<ExecuteAsync>b__8_1()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MyApp.Server.Pages__Host.<ExecuteAsync>b__8_1()
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
   at MyApp.Server.Pages__Host.ExecuteAsync()
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)


info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished in 6011.3861ms 500

Here is the information from dotnet --info showing the platform, sdks, frameworks installed etc.:

PS C:\Users\AdamDavidson\source\repos\MyApp> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.402\

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  2.1.700 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Looking at Bolero.dll (0.15.18) in dotPeek show it has a dependency on Elmish 3.1.0.0 but the package only mentions Elmish 3.0.0.0 which might be why it’s not finding the dll that Bolero.dll expects. When I add Elmish 3.1.0.0 as a nuget package explictly I get a different error, so I’ve not yet found a workaround:

System.MissingMethodException: 'Method not found: 'Void Elmish.Program`4..ctor(Microsoft.FSharp.Core.FSharpFunc`2<!0,System.Tuple`2<!1,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Core.Unit>>>>, Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.FSharpFunc`2<!1,System.Tuple`2<!1,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Core.Unit>>>>>, Microsoft.FSharp.Core.FSharpFunc`2<!1,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Core.Unit>>>, Microsoft.FSharp.Core.FSharpFunc`2<!1,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.Unit>,!3>>, Microsoft.FSharp.Core.FSharpFunc`2<!1,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.FSharpFunc`2<!2,Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Core.Unit>>, Microsoft.FSharp.Core.FSharpFunc`2<System.Tuple`2<System.String,System.Exception>,Microsoft.FSharp.Core.Unit>)'.'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Tarmilcommented, Sep 19, 2020

This is fixed in Bolero 0.15.23 / Bolero.HotReload 0.15.4. Thanks everyone for the report, investigation and PR!

1reaction
naartjiecommented, Sep 18, 2020

Cool @davedawkins, I’m glad that works on Windows too.

I had a go at a PR in #181, but not sure that’s all that’s needed to fix the dependency.

Also with hot reloading, not sure what is broken there. Maybe someone else reading this knows what’s up there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bolero-app template using Bolero.dll (0.15.18) throws could not ...
Creating a Bolero app from the template with defaults, results in the following error: fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id " ...
Read more >
TypeLoadException with Bolero 0.16 and .NET 5.0 #192
Build to match the current 16.5 Template causes other resources to not load. Again, on my machine, creating a fresh Bolero 16 Hello...
Read more >
Could not load file or assembly ... An attempt was made to ...
In my case a dependency was missing in the dll that threw this exception. I checked with Dependency Walker, added the missing dll...
Read more >
How I Got Started with Bolero!
Running the Dotnet Commands. After that, I opened a cmd and run the following commands. Install the project template: BAT.
Read more >
Bolero: F# in WebAssembly
Invoke server-side code hosted on ASP.NET Core as a simple asynchronous function call. Easily integrate such a call in the Elmish update function....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found