fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
516 stars 153 forks source link

StackOverflowException when generating reference documentation #170

Closed Rickasaurus closed 7 years ago

Rickasaurus commented 9 years ago

This is really strange - it's happening on our build server but not when we build locally:

Process is terminated due to StackOverflowException. Running build failed.

Error: System.Exception: generating reference documentation failed at FSI_0001.Build.clo@194-19.Invoke(Unit _arg3) in C:\Builds\14\FSharp.ToolBelt\FSharp.ToolBelt Nuget Release\src\build.fsx:line 196 at Fake.TargetHelper.runTarget@329(String targetName) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 343 Status: Failure

tpetricek commented 9 years ago

Can you share what is in build.fsx on line 196?

If this is invoking F# Formatting to generate XML documentation, then I think we might have seen this error before (cc @matthid). But the best choice would be to update to the latest F# Formatting, where a lot of things have been significantly improved (thanks to @matthid's great work :-))

Rickasaurus commented 9 years ago

Sure, 196 is the second line of:

Target "GenerateReferenceDocs" (fun _ ->
    if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:RELEASE"; "--define:REFERENCE"] [] then
      failwith "generating reference documentation failed"
)
Rickasaurus commented 9 years ago

What's the best way to update? Just pull the latest docs/tools from the scaffold git?

matthid commented 9 years ago

It's hard to tell without the stack trace of the overflow, however most of the time when this happens it is related to FSharp.Compiler.Service getting an invalid FSharp.Core.dll and FSharp.Core.(optdata/sigdata) combination.

To further track this down: Is your build setup to emit a FSharp.Core.dll in the output directory? Can you try emitting FSharp.Core.sigdata and FSharp.Core.optdata as well or try removing any FSharp.Core related files? Is FSharp actually installed on the build server? What OS is your build server using? FSharp.Formatting version? Mono version? F# version? Can you try to get the underlying stack trace. For example by running the fsi directly with

cd docs/tools && mono --debug fsi.exe generate.fsx --define:RELEASE --define:REFERENCE

Further information: http://fsharp.github.io/FSharp.Compiler.Service/corelib.html and http://fsharp.github.io/2015/04/18/fsharp-core-notes.html

davidpodhola commented 9 years ago

I am experiencing the same behavior. What is strange is, that running fsi.exe generate.fsx --define:RELEASE --define:REFERENCE works generate

but running build GenerateReferenceDocs not generatereferencedocs

To answer the other questions: Is your build setup to emit a FSharp.Core.dll in the output directory? YES, 4.3.1 Can you try emitting FSharp.Core.sigdata and FSharp.Core.optdata as well or try removing any FSharp.Core related files? Is FSharp actually installed on the build server? YES, this is from my dev machine What OS is your build server using? Windows 8.1 FSharp.Formatting version? FSharp.Formatting.2.9.6.nupkg (upgrading to the latest version from github did not help) Mono version? No Mono, .NET F# version? 4.3.1

troykershaw commented 9 years ago

I had this same problem. What solved it for me was to remove references to FSharp.Core from the offending projects and re add it. Works like a dream now!

larsw commented 9 years ago

I'm experiencing the same problem; @troykershaw by removing and re-adding FSharp.Core; did you manually edit the .fsproj files? AFAIK it is not possible to remove the FSharp.Core reference from the References folder in the project (in Visual Studio).

dsyme commented 7 years ago

This was fixed way back