fsbolero/Bolero

Error, unable to access property from server side remoting implementation

Closed this issue · 2 comments

This compiles all fine, but fails at runtime, so feels odd for F#! : )

image
type MockInfoService(
    ctx: IRemoteContext,
    env: IWebHostEnvironment,
    appSettings : AppSettings ) =
    inherit RemoteHandler<IMockInfoService>()
    
    // let configuredMocks gives the same error if we want to use a readonly private member instead...
    member val ConfiguredMocks =
        [
            for mockSetting in appSettings.MockSettings do
                
                let methods = 
                    (",", mockSetting.Request.Methods) 
                    |> String.Join

                { title = methods; pattern = mockSetting.Request.PathMatchesRegex }
        ]

    override this.Handler =
        {
            getMocks = fun () -> async {
                return this.ConfiguredMocks
            }
        }
Tarmil commented

This is odd indeed. I haven't managed to reproduce this issue. Here is my working version, if you want to check the rest of the project for differences with yours.

I solved by upgrading all libraries, it was an issue with library mismatch at runtime i think