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

Fornax crashes on build #84

Open
oluwandabira opened this issue May 19, 2021 · 4 comments
Open

Fornax crashes on build #84

oluwandabira opened this issue May 19, 2021 · 4 comments

Comments

@oluwandabira
Copy link
Contributor

Describe the bug
Fornax crashes when attempting to build a project with error:

An unexpected error happend: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc`2 predicate, IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 677
   at FSI_0016.Post.generate'(SiteContents ctx, String page)
   at lambda_method17(Closure , Unit , SiteContents , String , String )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.EvaluatorHelpers.helper@56(Object next, FSharpList`1 args) in repos/Fornax/src/Fornax/Generator.fs:line 66
   at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in repos/Fornax/src/Fornax/Generator.fs:line 70
   at [email protected](Object generator) in repos/Fornax/src/Fornax/Generator.fs:line 195
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr callersRetAddrSlot, IntPtr callTarget, IntPtr retVal)
   at Generator.GeneratorEvaluator.evaluate(FsiEvaluationSession fsi, SiteContents siteContent, String generatorPath, String projectRoot, String page) in repos/Fornax/src/Fornax/Generator.fs:line 190
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in repos/Fornax/src/Fornax/Generator.fs:line 333
   at Generator.action@1-3(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in repos/Fornax/src/Fornax/Generator.fs:line 496
   at Generator.generateFolder(String projectRoot, Boolean isWatch) in repos/Fornax/src/Fornax/Generator.fs:line 495
   at Fornax.main$cont@185(ArgumentParser`1 parser, FSharpList`1 results, Unit unitVar) in repos/Fornax/src/Fornax/Fornax.fs:line 213

To Reproduce
Steps to reproduce the behaviour:

  1. Clone the Fornax repo
  2. Apply the change described in Support .NET SDK 5.0.202 and later #82
  3. Build the repo (dotnet tool restore, dotnet fake build, dotnet fake build -t Test)
  4. Create a new fornax project (fornax new)
  5. Attempt to build the project (fornax build)

Expected behaviour
Fornax builds the site.

Environment (please complete the following information):

  • OS: Ubuntu 20.04.2 LTS
  • Ionide version: 5.5.5
  • VSCode version: 1.56.1
  • dotnet SDK version: 5.0.203
  • mono / .Net Framework version:
@rdipardo
Copy link
Contributor

rdipardo commented May 21, 2021

Hey @oluwandabira, and others who might come across this:
the underlying problem with file filtering has been patched: https://github.com/rdipardo/Fornax/commit/95e0361a270cd6ef3a65793afb1a7a3335684245
Let me know if it works for you

@oluwandabira
Copy link
Contributor Author

Tested it and I still get the same error.

@oluwandabira
Copy link
Contributor Author

So the underlying issue still seems to be with ignored file paths?

@rdipardo
Copy link
Contributor

rdipardo commented May 25, 2021

So the underlying issue still seems to be with ignored file paths?

So I thought, but not any more.

fornax build should now be fixed: e681704

fornax watch is broken, because an empty instance of SiteContents is passed to the generator after a file event


I see there's no answer yet to #87, but I wouldn't expect the Generator to pick up this kind of error; it's only watching for the
FornaxGeneratorException type:

Fornax/src/Fornax/Fornax.fs

Lines 216 to 221 in 5902c57

| FornaxGeneratorException message ->
Console.WriteLine message
1
| exn ->
printfn "An unexpected error happend: %O" exn
1

Exceptions throw by generator scripts are emitted by FSI and not handled as far as I know.

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

Successfully merging a pull request may close this issue.

2 participants