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

SAFE template application fails to start when diagnostics are enabled #64

Closed
bartsokol opened this issue Jun 5, 2018 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@bartsokol
Copy link

bartsokol commented Jun 5, 2018

Steps to reproduce:

  • Create new app using SAFE template with remoting enabled (dotnet new SAFE -lang F# --remoting)
  • Try to build and start the app (build run)

Actual behaviour: server side (Saturn) application crashes with following exception:

Unhandled Exception: System.ArgumentException: The input sequence was empty.
Parameter name: source
   at Microsoft.FSharp.Collections.SeqModule.Last[T](IEnumerable`1 source)
   at Saturn.SiteMap.generate() in D:\Programowanie\Projekty\Saturn\Saturn\src\Saturn\Diagnostics.fs:line 55
   at Saturn.Application.run(IWebHostBuilder app) in D:\Programowanie\Projekty\Saturn\Saturn\src\Saturn\Application.fs:line 381
   at <StartupCode$Server>.$Server.main@() in C:\work\dotnet\SAFESample\src\Server\Server.fs:line 33

It looks like SiteMap.generate function is called on empty state. It should be updated with SiteMap.add function which seems to be never called.

Disabling diagnostics (using disable_diagnostics directive) solves the issue.

Environment: .NET Core SDK 2.1.300, Windows 10, Saturn 0.5

@Nhowka
Copy link
Contributor

Nhowka commented Jun 5, 2018

Maybe using Seq.tryLast could be safer with minimal changes.

@Krzysztof-Cieslak
Copy link
Member

Fixed in ee03b96

@Krzysztof-Cieslak Krzysztof-Cieslak added this to the 0.7 milestone Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants