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

Compilations errors with .NET 7 & Fable 3.0.1 #3278

Closed
OkayX6 opened this issue Nov 19, 2022 · 7 comments
Closed

Compilations errors with .NET 7 & Fable 3.0.1 #3278

OkayX6 opened this issue Nov 19, 2022 · 7 comments

Comments

@OkayX6
Copy link

OkayX6 commented Nov 19, 2022

Description

Working project doesn't compile anymore with Fable 3.0.1.
Fable 3.7 simply hangs.

Repro code

Any Fable project. Try with Feliz template
dotnet new feliz -n AwesomeApp

Expected and actual results

Expected results is that it compiles.
Actual results:

image

Related information

  • Fable version: 3.0.1
  • Operating system: Windows
  • .NET version:
.NET SDK:
 Version:   7.0.100
 Commit:    e12b7af219

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.100\

Host:
  Version:      7.0.0
  Architecture: x64
  Commit:       d099f075e4

.NET SDKs installed:
  5.0.404 [C:\Program Files\dotnet\sdk]
  6.0.101 [C:\Program Files\dotnet\sdk]
  6.0.302 [C:\Program Files\dotnet\sdk]
  6.0.400 [C:\Program Files\dotnet\sdk]
  7.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
@alfonsogarciacaro
Copy link
Member

alfonsogarciacaro commented Nov 20, 2022

Thanks a lot for the detailed report @OkayX6! Yes, unfortunately dotnet sdk 7 is giving problems. We've almost fixed it for the incoming Fable 4 (see #3279) but I'm not sure if we'll be able to patch it for Fable 3.

Can you please try upgrading to Fable 4? You should be able to upgrade any Feliz app with just two commands:

dotnet tool install fable --prerelease

# In your project directory
dotnet add package Feliz.CompilerPlugins --prerelease

@harvito
Copy link

harvito commented Nov 21, 2022

Just want to add that it also fails with Fable 2 but in a different way. This is from fable2-samples/nodejs with .net sdk 7.0.100

$ npm run build

> @ build C:\CODE\fable2-samples\nodejs
> fable-splitter src -o build --commonjs

fable-splitter 2.1.12
fable: Compilation started at 6:37:06 p.m.
fable-compiler 2.4.18
C:\CODE\fable2-samples\nodejs\src> dotnet restore App.fsproj
  Determining projects to restore...
  All projects are up-to-date for restore.


Parsing ./src/App.fsproj...
The list of files returned by F# compiler is empty
ERROR: File C:/CODE/fable2-samples/nodejs/src/App.fs cannot be found in source list:
 (C:/CODE/fable2-samples/nodejs/src/App.fs)
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1637.Invoke(String message) in E:\A\_work\130\s\src\fsharp\FSharp.Core\printf.fs:line 1637
   at Fable.Transforms.FSharp2Fable.Compiler.transformFile(ICompiler com, IDictionary`2 implFiles) in /workspace/Fable/src/Fable.Transforms/FSharp2Fable.fs:line 1169
ERROR: File C:/CODE/fable2-samples/nodejs/src/App.fs cannot be found in source list:
 (C:/CODE/fable2-samples/nodejs/src/App.fs)

@pkese
Copy link
Contributor

pkese commented Nov 30, 2022

@OkayX6, @harvito
If you can't install Fable 4 prerelease, then you can select an older version of dotnet SDK by adding a global.json file to the root of your project, containing e.g.:

{
    "sdk": {
      "version": "6.0.100",
      "rollForward": "latestFeature"
    }
}

You'll also need the older version of sdk (e.g. dotnet 6) installed besides dotnet 7. They can coexist just fine.

@OkayX6
Copy link
Author

OkayX6 commented Dec 3, 2022

Thanks @pkese for your tips!

Thanks a lot for the detailed report @OkayX6! Yes, unfortunately dotnet sdk 7 is giving problems. We've almost fixed it for the incoming Fable 4 (see #3279) but I'm not sure if we'll be able to patch it for Fable 3.

Can you please try upgrading to Fable 4? You should be able to upgrade any Feliz app with just two commands:

dotnet tool install fable --prerelease

# In your project directory
dotnet add package Feliz.CompilerPlugins --prerelease

Thanks @alfonsogarciacaro, it worked.

(By the way, It broke my webpack config, my Node ENV VARS stopped working)
I guess the parameters passed to them changed a bit, but I fixed my problem by tweaking the webpack.config.js.

@OkayX6 OkayX6 closed this as completed Dec 3, 2022
@alfonsogarciacaro
Copy link
Member

@OkayX6 Happy yo hear it worked for you!

Did you upgrade from Fable 2 or 3? In Fable 2 Webpack called Fable but since Fable 3 it is the other way around, maybe this caused by the issue with the env cars.

@OkayX6
Copy link
Author

OkayX6 commented Dec 5, 2022

Upgraded from Fable 3 :)

@harvito
Copy link

harvito commented Dec 7, 2022

Thanks for the global.json tip, this is working with Fable compiler 2. Will upgrade to 4 once it's GA.

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

4 participants