I'm attempting to host an openid connect identity server in a F# wep api project, I'm using the F# MVC templates and the pre-release package of identity server
When I create either of the Katana based web api projects and subsequently add the thinktecture.identityserver.v3 package the compile fails at the line
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver <- Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
with the error "this type has no accessible object constructors" with the CamelCasePropertyNamesContractResolver underlined
At that point I have not changed any of the code - just added the package
I have v1.13 of the vsix installed and this happens in both VS2013 and 2015 preview
I'm not sure whether this is an issue with the template, the package I added or f# in general? - any pointers on how to diagnose or where to report would be much appreciated
The same happens if I manually add a reference to the identity server assembly but I could not replicate when adding other nuget packages - how would adding a reference somehow mask the constructor from the newtonsoft type?
It only appears to affect that type - if I comment out that line the code compiles
full listing of startup.fs
namespace FSharpWeb1
open Owin
open Microsoft.Owin
open System
open System.Net.Http
open System.Web
open System.Web.Http
open System.Web.Http.Owin
[<Sealed>]
type Startup() =
static member RegisterWebApi(config: HttpConfiguration) =
// Configure routing
config.MapHttpAttributeRoutes()
// Configure serialization
config.Formatters.XmlFormatter.UseXmlSerializer <- true
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver <- Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
// Additional Web API settings
member __.Configuration(builder: IAppBuilder) =
let config = new HttpConfiguration()
Startup.RegisterWebApi(config)
builder.UseWebApi(config) |> ignore
UPDATE 1
Just for fun I repeated a similar exercise in Xamarin studio with the same results - as soon as the ref to identity server is added then it breaks
I also tried updating the version of newtonsoft to the latest stable and that didn't help
UPDATE 2
Turns out the identity server project uses ILMerge to merge in dependencies such as the newtonsoft dll - If I build the identity server core dll without using ILMerge and reference that then the problem does not occur - so is this an F# issue or with ILMerge hiding constructor?