Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load file or assembly 'Elmish, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null' #301

Closed
alfbostefan opened this issue Apr 14, 2023 · 3 comments

Comments

@alfbostefan
Copy link

It seems that I have a similar problem as the issue 180,

Doing this will trigger my error:

dotnet new install Bolero.Templates
dotnet new bolero-app -o Test
cd Test
dotnet run --project src/Test.Server

Navigation to http://127.0.0.1:5000 will trigger this error:

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://127.0.0.1:5000/ - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Fallback {*path:nonfile}'     
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Fallback {*path:nonfile}'      
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HMPSTF03GJD6", Request id "0HMPSTF03GJD6:00000001": An unhandled exception was thrown by the application.
      System.IO.FileNotFoundException: Could not load file or assembly 'Elmish, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
      File name: 'Elmish, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null'
         at Test.Client.Main.MyApp.get_Program()
         at Bolero.ProgramComponent`2.OnInitialized()
         at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
         at Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView parameters)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderRootComponentAsync(Int32 componentId, ParameterView initialParameters)
         at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.RenderComponentAsync(Type componentType, ParameterView initialParameters)
         at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c__11`1.<<InvokeAsync>b__11_0>d.MoveNext()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.ViewFeatures.StaticComponentRenderer.PrerenderComponentAsync(ParameterView parameters, HttpContext httpContext, Type componentType)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.RenderComponentAsync(ViewContext viewContext, Type componentType, RenderMode renderMode, Object parameters)
         at Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperComponentExtensions.RenderComponentAsync(IHtmlHelper htmlHelper, Type componentType, RenderMode renderMode, Object parameters)
         at Bolero.Server.Components.Rendering.renderCompTo@81.MoveNext()
         at Bolero.Server.Components.Rendering.renderPage@183.Bolero.Server.Components.Rendering.IRenderComponents.RenderComponent(Type ty, StringBuilder sb, IDictionary`2 attributes, Boolean forceStatic)      
         at Bolero.Server.Components.Rendering.render(IRenderComponents renderComp, ReadOnlySpan`1 frames, RenderState state, StringBuilder sb)
         at Bolero.Server.Components.Rendering.render(IRenderComponents renderComp, ReadOnlySpan`1 frames, RenderState state, StringBuilder sb)
         at Bolero.Server.Components.Rendering.render(IRenderComponents renderComp, ReadOnlySpan`1 frames, RenderState state, StringBuilder sb)
         at Bolero.Server.Components.Rendering.render(IRenderComponents renderComp, ReadOnlySpan`1 frames, RenderState state, StringBuilder sb)
         at Bolero.Server.Components.Rendering.renderWith(IRenderComponents renderComp, Node node)
         at Bolero.Server.Components.Rendering.renderPage(Node page, HttpContext httpContext, IHtmlHelper htmlHelper, IBoleroHostConfig boleroConfig)
         at <StartupCode$Bolero-Server>.$Extensions.RenderPage@61.MoveNext()
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.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 HTTP/1.1 GET http://127.0.0.1:5000/ - - - 500 0 - 195.9606ms

This is my dotnet-info:

 dotnet --info
.NET SDK:
 Version:   7.0.300-preview.23179.2
 Commit:    6d2b42e30e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.300-preview.23179.2\

Host:
  Version:      7.0.5
  Architecture: x64
  Commit:       8042d61b17

.NET SDKs installed:
  6.0.201 [C:\Program Files\dotnet\sdk]
  7.0.203 [C:\Program Files\dotnet\sdk]
  7.0.300-preview.23179.2 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

If I explicit add the 4.0.1 version of Elmish to the project it will work as expected. Let me know if there are any more information needed from me.

@Tarmil
Copy link
Member

Tarmil commented Apr 14, 2023

I think I see what's going on; due to some subtle package resolution hijinks, Bolero.HotReload.dll references Elmish.dll 4.0.1 even though the Bolero.HotReload package requires only the Elmish package >= 4.0.0. Adding an explicit Elmish package version will indeed work around the issue in your project.

It should possible to fix the root cause by tweaking the version constraints in Bolero.HotReload.

@Tarmil
Copy link
Member

Tarmil commented Apr 15, 2023

The newly released Bolero 0.22.43 and Bolero.HotReload 0.22.6 should solve this issue.

@stefanalfbo
Copy link

Yes indeed, works great now. Thanks for the fast response!

@Tarmil Tarmil closed this as completed Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants