Zaid-Ajaj / Fable.Remoting

Type-safe communication layer (RPC-style) for F# featuring Fable and .NET Apps
https://zaid-ajaj.github.io/Fable.Remoting/
MIT License
274 stars 57 forks source link

Method not found: Microsoft.IO.RecyclableMemoryStreamManager.GetStream(System.String) when calling remoting after upgrade #355

Closed Dzoukr closed 11 months ago

Dzoukr commented 11 months ago

Hello friend, after upgrading to the newer version, I got this exception when calling Remoting methods:

server: info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
server:       Request starting HTTP/1.1 POST http://localhost:5000/api/service/GetMessage - application/json;+charset=UTF-8 6
server: fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
server:       An unhandled exception has occurred while executing the request.
server:       System.MissingMethodException: Method not found: 'System.IO.MemoryStream Microsoft.IO.RecyclableMemoryStreamManager.GetStream(System.String)'.
server:          at Fable.Remoting.Giraffe.GiraffeUtil.buildFromImplementation@56-1.MoveNext()
server:          at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
server:          at Fable.Remoting.Giraffe.GiraffeUtil.buildFromImplementation@56.Invoke(FSharpFunc`2 next, HttpContext ctx)
server:          at NewTest.Server.WebApp.webApp@28-2.Invoke(HttpContext arg20)
server:          at Giraffe.GoodRead.Extensions.context@14.MoveNext()
server:          at Giraffe.Core.chooseHttpFunc@121.MoveNext()
server:          at Giraffe.Middleware.Invoke@30.MoveNext()
server:          at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
server: info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
server:       Request finished HTTP/1.1 POST http://localhost:5000/api/service/GetMessage - 500 - text/plain;+charset=utf-8 71.0667ms

Steps to reproduce

  1. dotnet new install SAFEr.Template
  2. dotnet new SAFEr
  3. dotnet run
  4. Click on the button on the example page - now it still works (using the older version in paket.lock)!
  5. Stop the server and run dotnet paket update Fable.Remoting
  6. dotnet run
  7. Click on the button on the example page - EXCEPTION

Thanks for any kind of hint here 🙏

kerams commented 11 months ago

You'll need to pin Microsoft.IO.RecyclableMemoryStream ~> 2

kerams commented 11 months ago

@Zaid-Ajaj, which way forward would you prefer? Constraining Remoting to v2, but then consumers are not able to upgrade, or requiring v3?

Zaid-Ajaj commented 11 months ago

@kerams I think the easiest is to update remoting to latest v3 of Microsoft.IO.RecyclableMemoryStream and constraining it to >= 3.0 && < 4.0 so that this doesn't happen the next time around when a new major version of Microsoft.IO.RecyclableMemoryStream is available

Zaid-Ajaj commented 11 months ago

@Dzoukr Should be fixed if you update everything to latest 😄 please re-open the issue if the problem persists

Dzoukr commented 11 months ago

Thanks a lot, friend! All the best in 2024! 🙏 ❤️