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

Error: Method not found: 'Boolean Fable.CompilerOptions.Equals(Fable.CompilerOptions, System.Collections.IEqualityComparer)'. #4019

Closed
nojaf opened this issue Jan 22, 2025 · 27 comments

Comments

@nojaf
Copy link
Member

nojaf commented Jan 22, 2025

Hi @MangelMaxime and @ncave,

I was trying to update Fable.Compiler in the vite plugin to 5.0.0-alpha.5 and I got:

Error: Method not found: 'Boolean Fable.CompilerOptions.Equals(Fable.CompilerOptions, System.Collections.IEqualityComparer)'.

at runtime. Did anything change?
I have this for 5.0.0-alpha.4 and 5.0.0-alpha.5.

@ncave
Copy link
Collaborator

ncave commented Jan 22, 2025

@nojaf Not sure, I recently added comparisons for some primitive types, but it's still unreleased, so that's probably not it.

Is there a small repro of what are you trying to send to the Fable.Compiler? Can it be converted to a test for the Fable.Compiler?

@ncave
Copy link
Collaborator

ncave commented Jan 22, 2025

@nojaf The only equality comparison for Fable.CompilerOptions I could find is this one, but I'm not sure what could be wrong with it, or in what case it gets triggered (some sort of option caching?).

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

Weird, I'm passing NoCache = true so I shouldn't be hitting that code path.

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

Okay, I tried using a local version of the Fable.Compiler and I didn't have any issue with that build. So maybe, this problem will be resolved in the next alpha.

(@MangelMaxime I would also need a new version of @fable-org/fable-library-js when the next alpha is published)

@MangelMaxime
Copy link
Member

(@MangelMaxime I would also need a new version of @fable-org/fable-library-js when the next alpha is published)

In theory, I always release it when we make a change to it, but perhaps I mess it up last time sorry.

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

I'm not saying you messed up or anything, just that it will be required for next alpha.

@MangelMaxime
Copy link
Member

MangelMaxime commented Jan 23, 2025

@nojaf I made a new release of Fable, you should be able to check if it fixes your issue.

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

Thanks, I still have the same problem unfortunately.

@MangelMaxime
Copy link
Member

You said you didn't have the issue with a local build? Was it a Debug build?

Could you perhaps try a Release build and/or local pack of the package to mimic a NuGet release?

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

I did do a Release build. How do I pack, is there a build.sh thing?

@MangelMaxime
Copy link
Member

MangelMaxime commented Jan 23, 2025

You can run ./build.sh package it will create temporary packages for:

  • Fable.Cli
  • Fable.Compiler
  • Fable.Core

On futur run, if you don't change the fable-library code you can run ./build.sh package --skip-fable-library to avoid re-compiling the fable-library code.

Make sure to pull the latest version of main as I just added support for Fable.Compiler in it.

Edit:

Important every time, you rebuild using ./build.sh package you need to re-run the printed command. Each new build has a unique version number to force NuGet to pick the changes.

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

./src/fable-library-py/fable_library/List.fs(339,10): (339,12) warning FABLE: Generic args are ignored in type testing
./src/fable-library-ts/Set.fs(36,18): (36,20) warning FABLE: Generic args are ignored in type testing
./src/fable-library-ts/Map.fs(34,18): (34,20) warning FABLE: Generic args are ignored in type testing
Copy stage
Post Fable build stage
Fable.Build: poetry install
System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'poetry' with working directory '/Users/nojaf/Projects/Fable'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)

Yeah, I don't wanna install poetry nor any Rust stuff.

What do I need to run to pack Fable.AST and Fable.Compiler only?

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

Okay, after messing a bit with src/Fable.Build/Package.fs I got the NuGet packages.
All is fine when I reference those.
So, no clue what the problem is here 🙃

@MangelMaxime

This comment has been minimized.

@MangelMaxime
Copy link
Member

I am kind of out of idea here 😅

Could it be caused because this is compile from another machine/OS ?

For publishing, Fable I am using the devcontainer include in Fable repository. You could try to spawn it, run ./build.sh package and check if they work or no.

@nojaf
Copy link
Member Author

nojaf commented Jan 23, 2025

Welp, that leads me to

Fable.Build: dotnet run -c Release --project /workspaces/Fable/src/Fable.Build/../Fable.Cli -- src/fable-library-ts --outDir temp/fable-library-ts --fableLib ./temp/fable-library-ts --lang typescript --exclude Fable.Core --define FABLE_LIBRARY --noCache --typedArrays false --define FX_NO_BIGINT
Using launch settings from /workspaces/Fable/src/Fable.Build/../Fable.Cli/Properties/launchSettings.json...
/home/vscode/.dotnet/sdk/9.0.101/FSharp/Microsoft.FSharp.Targets(354,9): error MSB6006: "dotnet" exited with code 132.

The build failed. Fix the build errors and run again.
SimpleExec.ExitCodeException: The command exited with code 1.
   at SimpleExec.Command.Run(ProcessStartInfo startInfo, Boolean noEcho, String echoPrefix, Func`2 handleExitCode, Boolean cancellationIgnoresProcessTree, CancellationToken cancellationToken) in /_/SimpleExec/Command.cs:line 134
   at SimpleExec.Command.Run(String name, String args, String workingDirectory, Boolean noEcho, String echoPrefix, Action`1 configureEnvironment, Boolean createNoWindow, Func`2 handleExitCode, Boolean cancellationIgnoresProcessTree, CancellationToken cancellationToken) in /_/SimpleExec/Command.cs:line 60
   at SimpleExec.Command.Fable.Static(FSharpOption`1 argsBuilder, FSharpOption`1 workingDirectory, FSharpOption`1 noEcho, FSharpOption`1 echoPrefix) in /workspaces/Fable/src/Fable.Build/SimpleExec.Extensions.fs:line 42
   at Build.FableLibrary.BuildFableLibrary.Run(FSharpOption`1 skipIfExist) in /workspaces/Fable/src/Fable.Build/FableLibrary/Core.fs:line 78
   at Build.Package.handle(FSharpList`1 args) in /workspaces/Fable/src/Fable.Build/Package.fs:line 18
   at Build.Main.main(String[] argv) in /workspaces/Fable/src/Fable.Build/Main.fs:line 150%    

The dev container isn't doing it for me 🙃.

I might just archive my project really...

@ncave
Copy link
Collaborator

ncave commented Jan 23, 2025

@nojaf FWIW, running dotnet test in /vite-plugin-fable/Fable.Daemon.Tests/ on latest main succeeds for me locally (Ubuntu, .NET 9.0.102, Fable.Compiler 5.0.0-alpha.7), if I change the Fable.Daemon.Tests.fsproj TFM to net9.0.
Not sure if that is helpful at all, just sharing.

   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
NUnit Adapter 4.2.0.0: Test execution complete
  Fable.Daemon.Tests test succeeded with 1 warning(s) (2.7s)
    /dotnet/sdk/9.0.102/Microsoft.TestPlatform.targets(48,5): warning : 
      response: Error "tryCompileFile is entered without CrackerInput"

Test summary: total: 1, failed: 0, succeeded: 1, skipped: 0, duration: 2.6s

@nojaf
Copy link
Member Author

nojaf commented Jan 24, 2025

@ncave can you run bun run postinstall in the root and then run bun run build in the ./sample? (./sample needs bun install as well)

@ncave
Copy link
Collaborator

ncave commented Jan 24, 2025

@nojaf Assuming you mean ./sample-project, it's failing with:

$ bun install

$ bun run postinstall

$ dotnet publish Fable.Daemon/Fable.Daemon.fsproj --nologo -c Release --ucr -p:PublishReadyToRun=true -o ./bin
Restore complete (1.6s)
  Fable.Daemon succeeded (56.4s) → bin/

Build succeeded in 58.5s

$ cd ./sample-project/

./sample-project$ bun install
bun install v1.2.0 (b0c5a765)

+ @types/[email protected]
+ @types/[email protected]
+ @vitejs/[email protected]
+ [email protected]
+ [email protected]
+ @fable-org/[email protected]
+ [email protected]
+ [email protected]

91 packages installed [226.00ms]

./sample-project$ bunx --bun vite build
4:27:44 AM [vite] [fable]: configResolved: Configuration: Release
4:27:44 AM [vite] [fable]: configResolved: Entry fsproj .../vite-plugin-fable/sample-project/App.fsproj
vite v6.0.1 building for production...
4:27:44 AM [vite] [fable]: buildStart: Starting daemon
4:27:44 AM [vite] [fable]: projectChanged: dependent file .../vite-plugin-fable/sample-project/App.fsproj changed.
4:27:44 AM [vite] [fable]: compileProject: Full compile started of .../vite-plugin-fable/sample-project/App.fsproj
4:27:44 AM [vite] [fable]: compileProject: fable-library located at .../vite-plugin-fable/node_modules/@fable-org/fable-library-js
4:27:44 AM [vite] [fable]: compileProject: about to type-checked .../vite-plugin-fable/sample-project/App.fsproj.
x Build failed in 125ms
error during build:
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite-plugin-fable) buildStart
    at handleBeforeExit (.../vite-plugin-fable/sample-project/node_modules/rollup/dist/es/shared/node-entry.js:21150:32)
error: script "build" exited with code 1

Note: Updating the fable-library dependence to "@fable-org/fable-library-js": "^1.10.0", didn't help, same error.

@nojaf
Copy link
Member Author

nojaf commented Jan 24, 2025

Is there nothing more in the error? Is this the full trace?
I see the Error: Method not found: up to this point.

@ncave
Copy link
Collaborator

ncave commented Jan 24, 2025

@nojaf No, there is nothing else. Are you running that build in your CI?

@nojaf
Copy link
Member Author

nojaf commented Jan 27, 2025

@ncave
Copy link
Collaborator

ncave commented Jan 27, 2025

@nojaf Yes, I can reproduce it locally, and as you said, it starts breaking in 5.0.0-alpha.4, but works just fine if you reference the Fable.Compiler project directly (locally).

The thing is, there is very little change between 5.0.0-alpha.3 and 5.0.0-alpha.4. It's quite baffling, there are no changes in any package references. But I can reproduce on .NET 9 too, and updating all other packages to latest doesn't make any difference either. Very strange, on the face of it sounds like some sort of TFM mixup, but I'm not sure, cause I don't think anything changed much between those releases.

All I can think of is, perhaps you can switch to referencing the Fable.Compiler project by source, and package like that, if that's an option for you.

@nojaf
Copy link
Member Author

nojaf commented Jan 28, 2025

Could it be the bump from 8.0.100 to 8.0.404?
It feels like dotnet/fsharp#17773 and gets resolved locally for me when I add --realsig+ compiler flag.

@MangelMaxime
Copy link
Member

@nojaf I made a new release 5.0.0-alpha.9 with your fix

@nojaf
Copy link
Member Author

nojaf commented Jan 28, 2025

Solved in Fable.AST 4.6.0-beta.1

@nojaf nojaf closed this as completed Jan 28, 2025
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