SuaveIO / suave

Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
https://suave.io
Other
1.32k stars 198 forks source link

CoreRT compiled binaries not working #735

Closed lpeixotoo closed 5 years ago

lpeixotoo commented 5 years ago

Hi guys,

I've been trying to come up with a basic web server using Suave + CoreRT. Check this repo for source code and error analysis. When I start the generated executable, it yields the following exception:

Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: path1
   at System.IO.Path.Combine(String, String) + 0x53
   at Suave.Web.startWebServerAsync(SuaveConfig, FSharpFunc\`2) + 0x46
   at Suave.Web.startWebServer(SuaveConfig, FSharpFunc\`2) + 0x17
   at Program.main(String[]) + 0x28
   at Simple-Web!<BaseAddress>+0x7d639d
Aborted
ademar commented 5 years ago

@OshoNot I have pushed a new version 2.5.6 that fix the above exception.

Unfortunately it fails now further ahead on some printf usage. printf uses reflection which is problematic.

https://dotnet.github.io/native/troubleshooter/method.html

Exception:

EETypeRva:0x01A3C438(System.Reflection.MissingRuntimeArtifactException): MakeGenericMethod() cannot create this generic method instantiation because the instantiation was not metadata-enabled: 'Microsoft.FSharp.Core.PrintfImpl.Specializations<Microsoft.FSharp.Core.Unit,System.String,System. String>.Final1 (System.String,Microsoft.FSharp.Core.FSharpFunc<System.String,System.String>,System.String)' For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868

at nternal.Reflection.Core.Execution.ExecutionEnvironment.GetMethodInvoker(RuntimeTypeInfo, QMethodDefinition, RuntimeTypeInfo[], MemberInfo) + 0x15a at System.Reflection.Runtime.MethodInfos.NativeFormat.NativeFormatMethodCommon.GetUncached MethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x51 at System.Reflection.Runtime.MethodInfos.RuntimeMethodInfo.get_MethodInvoker() + 0xab at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.MakeGenericMethod(Type[])

  • 0x121 at Microsoft.FSharp.Core.PrintfImpl.PrintfBuilder3.buildPlainFinal(Object[], Type[]) + 0x271 at Microsoft.FSharp.Core.PrintfImpl.PrintfBuilder3.BuildT + 0x42 at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey, Func2) + 0x80 at Microsoft.FSharp.Core.PrintfImpl.Cache4.Get(PrintfFormat4) + 0x6b at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenT + 0x1a at Suave.Utils.Collections.getFirst(FSharpList1, String) + 0x72 at <StartupCode$Suave>.$ConnectionFacade.processRequest@488-4.Invoke(String) + 0x38 at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a, b] (AsyncActivation1, FSharpFunc`2, b) + 0x27
lpeixotoo commented 5 years ago

Hi @ademar ,

This is actually a CoreRT directive, one need to use the rd.xml for reflection. I think this issue can be closed since once we add the rd.xml file, everything runs ok.