Fornax crashes on build
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:
- Clone the Fornax repo
- Apply the change described in #82
- Build the repo (
dotnet tool restore,dotnet fake build,dotnet fake build -t Test) - Create a new fornax project (
fornax new) - 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:
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
Tested it and I still get the same error.
So the underlying issue still seems to be with ignored file paths?
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: https://github.com/ionide/Fornax/commit/e6817040f3c7bffc4b78d04d0363b562f3c8bf1c
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:
https://github.com/ionide/Fornax/blob/5902c57f42ced02d9c825bb7a6a41543499cc88a/src/Fornax/Fornax.fs#L216-L221
Exceptions throw by generator scripts are emitted by FSI and not handled as far as I know.