Currently, anonymous records (ARs) are only fully supported in client-side code. Attempting to return ARs from RPCs yields a warning, similar to:
warning WS9002: Remote method is returning a type which is not fully supported on client side. Add a JavaScript attribute or proxy for <>f__AnonymousType2954218042`6
Even though this is a warning, the application fails at runtime as well when invoking the RPC:
System.Exception: Could not load method (GetUserByName : System.String -> Microsoft.FSharp.Control.FSharpAsync`1<Microsoft.FSharp.Core.FSharpOption`1<<>f__AnonymousType2954218042`6<System.DateTime, System.String, System.Int32, System.Boolean, System.String, System.String>>>) candidates: [|"(GetUserByName : System.String -> Microsoft.FSharp.Control.FSharpAsync`1<Microsoft.FSharp.Core.FSharpOption`1<<>f__AnonymousType1909222319`6<System.DateTime, System.String, System.Int32, System.Boolean, System.String, System.String>>>)"|]
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message)
at WebSharper.Core.AST.Reflection.LoadMethod(Hashed`1 td, Hashed`1 m)
at WebSharper.Core.Remoting.Server.getConverter(MethodHandle m)
at WebSharper.Core.Remoting.clo@206-1.Invoke(MethodHandle delegateArg0)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at WebSharper.Core.Remoting.Server.getCachedConverter(MethodHandle m)
at WebSharper.Core.Remoting.Server.HandleRequest(Request req)
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 447
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
at WebSharper.AspNetCore.Remoting.handleRemote@62.MoveNext()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
This ticket is to address this issue and enable returning and accepting ARs from RPCs.
Currently, anonymous records (ARs) are only fully supported in client-side code. Attempting to return ARs from RPCs yields a warning, similar to:
Even though this is a warning, the application fails at runtime as well when invoking the RPC:
This ticket is to address this issue and enable returning and accepting ARs from RPCs.