SAFE-Stack / SAFE-template

dotnet CLI template for SAFE project
MIT License
282 stars 87 forks source link

Server test is throwing NRE due to F# known issue #492

Closed teknikal-wizard closed 2 years ago

teknikal-wizard commented 2 years ago

Currently the Server test throws a null reference exception when adding a Todo.

I believe this is due to a known F# issue

We could add an explicit entry point or revert to using a class for the Storage instead of a module?

I also think this, along with the broken tests when the class was first replaced with a module, are a strong case for us running the content unit tests in the CI pipeline in addition to the template ones.

teknikal-wizard commented 2 years ago

@isaacabraham

theimowski commented 2 years ago

I don't think this is related to the issue you linked - the [<EntryPoint>] attribute is there and has been before the changes. To me it seems that there's some issue with todos ResizeArray not being initialised for some reason. Anyway thanks for noticing that - needs to be fixed before we release next template version. :+1: for adding unit tests to CI - see #493

EDIT:

The [<EntryPoint>] is indeed necessary, but not for tests project but rather server:

[<EntryPoint>]
let main _ =
    run app
    0

Above fixes the issue.

Related SO Thread

If I were to choose, I'd revert back to the class approach, but that's just me :)

teknikal-wizard commented 2 years ago

I was told yesterday on Slack that upgrading the tests project to .NET 6 fixes the issue as well, and that someone is working on an update. I haven't tried this myself though yet.

olivercoad commented 2 years ago

If I were to choose, I'd revert back to the class approach, but that's just me :)

Is that just because of this issue or other reasons?