WebSharper

I've created a new project using the template "UI.Next Client-Server Applicatin". On running from VS I get a server error (stack trace below).

Running VS2015, WebSharper 3.6.18.241.

Any idea how to get this working?

ArgumentException: An item with the same key has already been added. System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52 System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) +11775650 System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) +15 WebSharper.Web.Shared.allReferencedAssemblies() +179 WebSharper.Web.Shared.loadMetadata() +67 .$WebSharper.Web.Shared..cctor() +67

TypeInitializationException: The type initializer for '.$WebSharper.Web.Shared' threw an exception. WebSharper.Web.Shared..cctor() +31

TypeInitializationException: The type initializer for 'WebSharper.Web.Shared' threw an exception. WebSharper.Web.Shared.get_Metadata() +0 .$RpcModule..cctor() +24

TypeInitializationException: The type initializer for '.$RpcModule' threw an exception. WebSharper.Web.RpcHandler..cctor() +31

TypeInitializationException: The type initializer for 'WebSharper.Web.RpcHandler' threw an exception. WebSharper.Web.RpcHandler..ctor() +0 WebSharper.Web.RpcModule..ctor() +46

TargetInvocationException: Exception has been thrown by the target of an invocation. System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +206 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object args, CultureInfo culture, Object activationAttributes, StackCrawlMark& stackMark) +1065 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object args, CultureInfo culture, Object activationAttributes) +124 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object args, CultureInfo culture) +20 System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object args) +60 System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +191 System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1068 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo handlers) +82 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

HttpException (0x80004005): Exception has been thrown by the target of an invocation. System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947444 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

  • JankoA

    Hi,

    this must be some problem with initializing the project by Visual Studio, it seems that some project reference is added multiple times and WebSharper 3 handled it wrong. Did the issue persist after reloading the project? (fixed in Zafir - WS4 beta)

  • Dark_Clark

    Hello. I have very similar issue while running the app on the remote hosting server. However all is OK on my machine while running with VS 2017 Community, F# 4.1, WebSharper 3.6.19.242, .NET 4.6. According to the info specified by hosting provider, their server supports ASP.NET 4.0, .NET <=4.6.3. How can I fix the problem?

    P.S.: Here is a gist with stack trace in my case.