I am trying to host an openid connect authentication server in an ap # F # api project, I am using F # MVC templates and an authentication server pre-release package
When I create any of the Katana-based api web projects and subsequently add the thinktecture.identityserver.v3 package, compilation fails with an error in the line
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver <- Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
with the error "this type has no accessible object constructors" with an underlined expression CamelCasePropertyNamesContractResolver
At this moment I did not change any code - just added a package
I have vsix installed v1.13, and this happens both in VS2013 preview and in 2015
I'm not sure if this is a problem with the template, the package I added, or f # in general? - any pointers on how to diagnose or where to report will be highly appreciated
The same thing happens if I manually add the link to the identity server assembly, but cannot replicate when adding other nuget packages - how would adding the link somehow mask the constructor from the newtonsoft type?
This seems to affect this type - if I comment on this line, the code compiles
full list 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 the Xamarin studio with the same results - as soon as a link to the authentication server is added, it breaks
I also tried updating version of newtonsoft to the latest stable version, and that didn't help
UPDATE 2
It turns out that the identity server project uses ILMerge to combine dependencies such as dll newtonsoft. If I create the server ID server core without using ILMerge and a link, then the problem does not arise - is it a problem with F # or with ILMerge Hide Constructor?