thoth-org / Thoth.Json.Giraffe

https://thoth-org.github.io/Thoth.Json/#Giraffe
7 stars 10 forks source link

Upgrade to giraffe 5 #19

Closed MangelMaxime closed 3 years ago

MangelMaxime commented 3 years ago

Hello @forki, @dustinmoris

this PR follow our discussion on twitter

@forki can you please test if the version 5.0.0-beta-001 fix the problem and work as expected?

I adapted the project to make it compile and have the tests green.

I had to add

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

to the fsproj and that's the first time I encounter that. Did I do well?

baronfel commented 3 years ago

The FrameworkReference is the correct way to add references to AspNetCore since .net Core 3.x. The old nuget packages are no longer provided and this is the official way forward. You might not have seen this before because if you use the Microsoft.NET.Sdk.Web SDK in your project file, the FrameworkReference is added for you: https://github.com/dotnet/sdk/blob/d97646de6b6dacadcccee7455cae5d43558ebc2e/src/WebSdk/Web/Sdk/Sdk.props

MangelMaxime commented 3 years ago

Thank you for the explanation @baronfel

baronfel commented 3 years ago

Everybody seems to be hitting this over the past week or so, I've explained the implicit FrameworkReference thing to like 20 people it seems :D

object commented 3 years ago

It seems that this PR is going to fix out issue.

MangelMaxime commented 3 years ago

@object

Indeed, it should work in theory, I am just waiting for @forki to confirm it in it's project.

Or if someone else is using Girafe and can confirm that it is working for their "real" application, it is also good for me.

I am waiting because even if the tests are green I don't use Giraffe / .NET myself, so I can't test it against a real project. And I am not as confident as when working on Fable/JavaScript ecosystem 😉

forki commented 3 years ago

let's assume it fixes it. compile error is gone.

object commented 3 years ago

Give me 1 hour. I will deploy it in our project and verify that client-server comminication works. We are using Giraffe with Thoth JSON serialization and also have a Fable app that both sends and receives JSON data.

forki commented 3 years ago

@dustinmoris updated TokenRouter - so I was able to test this. Works! Thanks for super fast fix.

MangelMaxime commented 3 years ago

Thank you for confirming @forki

I just released version 5.0.0

object commented 3 years ago

I am having some problems right now but apparently they are due to Elmish.Bridge.Giraffe that needs an update:

Application: Oddjob.WebApi.exe CoreCLR Version: 5.0.20.51904 .NET Version: 5.0.0 Description: The process was terminated due to an unhandled exception. Exception Info: System.TypeInitializationException: The type initializer for '<StartupCode$WebApi>.$SocketApp' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Giraffe, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040) File name: 'Giraffe, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' at Elmish.Bridge.Giraffe.server(String endpoint, FSharpFunc`2 inboxCreator) at <StartupCode$WebApi>.$SocketApp..cctor() in C:\BuildAgent\work\7909344bbc7bda34\src\WebApi\SocketApp.fs:line 44 --- End of inner exception stack trace ---

Working with this.

MangelMaxime commented 3 years ago

I guess Elmish.Brigde maintainer need to release a new version like I did to support Giraffe 5.

object commented 3 years ago

He did, 3 days ago. So I hope that it's just to recompile against the new version. Deploying new version now.

object commented 3 years ago

Yeah! It all works now. Thanks for the speedy update, @MangelMaxime and to @forki and myself for testing it!