Fable: Update of DotNet.Proj breaks script (fsx) compilation

Created on 6 Aug 2019  路  5Comments  路  Source: fable-compiler/Fable

Description

Compiling a script with 2.3.17 does not work anymore. Probably due to https://github.com/fable-compiler/Fable/commit/10858d91083f2f9c73bb46a571622d3dc769257c.

Some change will be needed in https://github.com/fable-compiler/Fable/blob/master/src/Fable.Cli/ProjectCracker.fs#L140

Repro code

https://github.com/fable-compiler/fable2-samples/tree/master/fsx-script could be used to reproduce the problem.

Expected and actual results

fable-splitter 2.1.10
fable: Compilation started at 8:33:19 AM
fable-compiler 2.3.17
ERROR: An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.ArrayModule.loop@459-38[T,TResult](FSharpFunc`2 chooser, T[] array, Int32 i)
   at Fable.Cli.ProjectCracker.getProjectOptionsFromScript(String[] define, String scriptFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 140
   at Fable.Cli.ProjectCracker.retry@336(String[] define, String projFile, DateTime retryUntil, Unit unitVar0) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 338
   at Fable.Cli.ProjectCracker.getFullProjectOpts(String[] define, String rootDir, String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 400
   at Fable.Cli.Agent.createProject(Message msg, String projFile, FSharpOption`1 prevProject) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 135
   at [email protected](Unit unitVar0) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 215
   at [email protected](Unit unitVar) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 287
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$FSharp-Core>[email protected](AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
ERROR: An index satisfying the predicate was not found in the collection.

Related information

  • Fable version: 2.3.17
  • Operating system: Windows

Most helpful comment

I'm working on a fix, it basically doesn't have the bad mscorelib dll on Windows.

image

Fix is rather simple, now it is not finding str in Fable.React so still looking into that. Don't think the upgrade will be a problem.

All 5 comments

Ah, damn! This happened when upgrading Dotnet.ProjInfo from 0.33 to 0.36. Any idea what may have changed between these releases that affected .fsx compilation @enricosada?

BTW, one of the reasons I upgraded Dotnet.ProjInfo is because the build server in one of my projects fails periodically with the following error and I wanted to check whether upgrading the library could help:

ERROR: MSBuild failed with exitCode 134 Working Directory: '/builds/demetrixbio/gsl_web/src/Demetrix.Frontend/adminontologydomain' Exe Path: 'dotnet' Args: 'msbuild /builds/demetrixbio/gsl_web/src/Demetrix.Frontend/adminontologydomain/AdminOntologyDomain.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=/tmp/tmp6ociBt.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=/tmp/tmpPnJGF7.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=/tmp/tmp8ZB6JL.tmp.GetProperties.txt /p:CustomAfterMicrosoftCommonTargets=/tmp/tmpA2lxOp.tmp.proj-info.hook.targets /p:CustomAfterMicrosoftCommonCrossTargetingTargets=/tmp/tmpA2lxOp.tmp.proj-info.hook.targets /nologo /verbosity:quiet'
   at Fable.Cli.ProjectCoreCracker.projInfo(FSharpList`1 additionalMSBuildProps, String file) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCoreCracker.fs:line 103
   at Fable.Cli.ProjectCracker.easyCrack(String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 292
   at [email protected](FSharpList`1 acc, String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 309
   at Microsoft.FSharp.Collections.ListModule.Fold[T,TState](FSharpFunc`2 folder, TState state, FSharpList`1 list)
   at Fable.Cli.ProjectCracker.getCrackedProjectsFromMainFsproj(String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 319
   at Fable.Cli.ProjectCracker.retry@335(String[] define, String projFile, DateTime retryUntil, Unit unitVar0) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 337
   at Fable.Cli.ProjectCracker.retryGetCrackedProjects(String[] define, String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 346
   at Fable.Cli.ProjectCracker.getFullProjectOpts(String[] define, String rootDir, String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/ProjectCracker.fs:line 399
   at Fable.Cli.Agent.createProject(Message msg, String projFile, FSharpOption`1 prevProject) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 135
   at Fable.Cli.Agent.checkIfProjectIsAlreadyInState(FSharpMap`2 state, Message msg, String projFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 179
   at Fable.Cli.Agent.tryFindAndUpdateProject(FSharpFunc`2 onNotFound, FSharpMap`2 state, Message msg, String sourceFile) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 196
   at [email protected](Unit unitVar) in /Users/alfonsogarciacaronunez/dev/fable/src/Fable.Cli/Agent.fs:line 287
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   at <StartupCode$FSharp-Core>[email protected](AsyncActivation`1 ctxt)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
/builds/demetrixbio/gsl_web/src/Demetrix.Frontend/all> dotnet restore All.fsproj

It's very weird because the error only happens from time to time in the CI server not locally and I haven't seen it in any other project either. And because the project is not open-source unfortunately is quite difficult to isolate and reproduce the issue :/

I'm working on a fix, it basically doesn't have the bad mscorelib dll on Windows.

image

Fix is rather simple, now it is not finding str in Fable.React so still looking into that. Don't think the upgrade will be a problem.

Hmm, might be more tricky after all.
I get a lot of errors in FSharpChecker:
image

@alfonsogarciacaro is this normal? Probably not.
In this specific case, I'm also missing Fable.Helper.React.fs as one of my projects implementations files. This will most likely be the reason why I'm getting str is not defined.

Nevermind, fix was indeed what I originally mentioned.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

et1975 picture et1975  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments

forki picture forki  路  3Comments

krauthaufen picture krauthaufen  路  3Comments

tomcl picture tomcl  路  4Comments