rules_dotnet icon indicating copy to clipboard operation
rules_dotnet copied to clipboard

[Next] Expecto cannot find method implementation from a dependency

Open njlr opened this issue 3 years ago • 0 comments

Probably easiest to just see this repo: https://github.com/njlr/bazel-expecto-repro

Basically I have a netstandard2.1 library that I am testing using a net6.0 binary.

The code builds with Bazel and the tests pass with MS Build.

$ dotnet run --project ./ratio.tests
[20:34:49 INF] EXPECTO? Running tests... <Expecto>
[20:34:49 INF] EXPECTO! 1 tests run in 00:00:00.0524229 for Ratio.+ works for simple cases – 1 passed, 0 ignored, 0 failed, 0 errored. Success! <Expecto>

However, running the test (bazel test //...) with Bazel gives a run-time error with Expecto tests:

System.TypeLoadException: Method 'Equals' in type 'Ratio.Ratio' from assembly 'ratio, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at [email protected](Unit unitVar)
   at [email protected](Unit unitVar) in /Users/h/dev/haf/expecto/Expecto/Expecto.Impl.fs:line 576
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104

Maybe I'm just missing something simple though?

njlr avatar Jul 13 '22 19:07 njlr