let a= 4
let f arg=
printfn "%s" (nameof arg)
f a
On https://fable.io/ it's working but it's not working with https://tryfsharp.fsbolero.io/ The first run the code on a server. The second run the code with webassembly on the computer calling this it.
arg
https://tryfsharp.fsbolero.io/
let a= 4
Compiler output:
Compilation succeeded.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: may not call directly, should always be optimized away
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x34197b0 + 0x000ce> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x34197b0 + 0x000f6> in <filename unknown>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) <0x3419060 + 0x00014> in <filename unknown>:0
at <StartupCode$WebFsc-Client>.$Executor+Run@42-1.Invoke (Microsoft.FSharp.Core.Unit unitVar) <0x4a37948 + 0x00028> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult] (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, TResult result1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] part2) <0x4a2e408 + 0x0001a> in <filename unknown>:0
at <StartupCode$FSharp-Core>.$Async+Delay@1064[T].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2e298 + 0x00036> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Invoke[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2ee98 + 0x000a0> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Bind[T,TResult] (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, Microsoft.FSharp.Control.FSharpAsync`1[T] part1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] part2) <0x4a374d8 + 0x00068> in <filename unknown>:0
at WebFsc.Client.ScreenOut+Wrap@109-3[a].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a373c8 + 0x00014> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Invoke[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2ee98 + 0x000a0> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult] (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, TResult result1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] part2) <0x4a2e408 + 0x00064> in <filename unknown>:0
at <StartupCode$FSharp-Core>.$Async+Delay@1064[T].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2e298 + 0x00036> in <filename unknown>:0
at <StartupCode$FSharp-Core>.$Async+Catch@1142[T].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2de80 + 0x00074> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Invoke[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2dae0 + 0x000a0> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Bind[T,TResult] (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, Microsoft.FSharp.Control.FSharpAsync`1[T] part1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] part2) <0x4a2d860 + 0x00068> in <filename unknown>:0
at Elmish.Cmd+bind@52-3[a].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x4a2d5d8 + 0x00014> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.Invoke[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x3a95c38 + 0x000a0> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult] (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, TResult result1, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] part2) <0x3a90ed8 + 0x00064> in <filename unknown>:0
at <StartupCode$FSharp-Core>.$Async+Delay@1064[T].Invoke (Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt) <0x3a90ce8 + 0x00036> in <filename unknown>:0
at Microsoft.FSharp.Control.AsyncPrimitives+StartWithContinuations@915[T].Invoke (Microsoft.FSharp.Core.Unit unitVar0) <0x3abbdd0 + 0x000b6> in <filename unknown>:0
at Microsoft.FSharp.Control.Trampoline.Execute (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] firstAction) <0x3a90560 + 0x0004a> in <filename unknown>:0
does the problem come from webassembly and why?
As @JL0PD correctly guessed in their comment, this is because Bolero's tryfsharp runs an older compiler that doesn't support nameof
.
Updating it has been on my to-do list for ever, but there have been non-trivial changes both in Blazor and in the F# compiler service since the latest release of tryfsharp.bolero.