fsbolero / Bolero

Bolero brings Blazor to F# developers with an easy to use Model-View-Update architecture, HTML combinators, hot reloaded templates, type-safe endpoints, advanced routing and remoting capabilities, and more.
https://fsbolero.io
Apache License 2.0
1.06k stars 53 forks source link

Seeing Endpoint compilation error #357

Closed fwaris closed 4 months ago

fwaris commented 4 months ago
type Page =
    | [<EndPoint "/authentication/{action}">] Authentication of action: string

All of sudden the above is not compiling any more (Bolero 0.23.52) with .Net 8.0.300

However, removing the union case field makes the compilation work - as below:

type Page =
    | [<EndPoint "/authentication/{action}">] Authentication

Would really appreciate quick help in this case.

fwaris commented 4 months ago

Update: this compilation error does not happen with a new project created from the template and then modified to have endpoint attributes.

Not sure what is tripping the compiler in my existing app

fwaris commented 4 months ago

I had langversion:preview set in my project. Commenting that out has fixed the error:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <!--<LangVersion>preview</LangVersion>-->
    <WasmEnableThreads>false</WasmEnableThreads>
    <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
  </PropertyGroup>

Maybe we can run into this in the future with a new F# version but closing the issue for now.