You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing a Markdown file in watch mode makes the generators/post.fsx script throw an unhandled KeyNotFoundException.
The reason seems to be that an empty instance of SiteContents is being passed to the script.
Strangely, the first generation cycle runs to completion without a problem.
To Reproduce
Clone the source tree
Add a debug message showing the value of the SiteContents argument before Seq.find gets called in generators/post.fsx, e.g.:
Notice that the SiteContents argument now contains no post data, crashing the build:
[23:09:45] Changes detected: /home/rob/dev/Fornax/src/Fornax.Template/posts/post.md
[23:09:48] multiple files generated in 638ms
[23:09:48] '/home/rob/dev/Fornax/src/Fornax.Template/_public/about.html' generated in 1ms
[23:09:48] '/home/rob/dev/Fornax/src/Fornax.Template/_public/contact.html' generated in 1ms
Model+SiteContents has 0 posts
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_0022.Post.generate'(SiteContents ctx, String page)
at lambda_method21(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 /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 66
at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 70
at [email protected](Object generator) in /home/rob/dev/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 /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 190
at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 333
at Generator.action@1-3(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 496
at Generator.generateFolder(String projectRoot, Boolean isWatch) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 495
at Fornax.guardedGenerate@226(String cwd, Unit unitVar0) in /home/rob/dev/Fornax/src/Fornax/Fornax.fs:line 228
Finished (Failed) 'TestTemplate' in 00:00:38.2120491
Expected behaviour
Watch mode should work.
Environment (please complete the following information):
Describe the bug
Changing a Markdown file in watch mode makes the
generators/post.fsx
script throw an unhandledKeyNotFoundException
.The reason seems to be that an empty instance of
SiteContents
is being passed to the script.Strangely, the first generation cycle runs to completion without a problem.
To Reproduce
SiteContents
argument beforeSeq.find
gets called ingenerators/post.fsx
, e.g.:Build the demo project:
The initial build finishes with output like this:
SiteContents
argument now contains no post data, crashing the build:Expected behaviour
Watch mode should work.
Environment (please complete the following information):
Additional context
This issue probably has the same underlying cause as #84
The text was updated successfully, but these errors were encountered: