[英]The type provider 'ProviderImplementation.HtmlProvider' reported an error: The 'Value'='XXXX' part of the cookie is invalid
[英]The type provider 'ProviderImplementation.JsonProvider' reported an error despite program working
我正在使用.net Core和Visual Studio 2017编写服务。我想使用JSON进行配置,因此我定义了如下类型:
type ServiceConfig = JsonProvider<"exampleConfig.json", EmbeddedResource="MyService, exampleConfig.json", SampleIsList = true>
在我的程序中,我像这样加载它:
let conf = ServiceConfig.Load "config.json"
当我运行它时,它工作正常,但是在VS 2017中,我得到了一条红色的波浪线,并且错误日志显示:
FS3033类型提供程序'ProviderImplementation.JsonProvider'在提供的类型'FSharp.Data.JsonProvider,Sample =“ exampleConfig.json”,SampleIsList =“ True”,EmbeddedResource =“ MyService,exampleConfig.json”'的上下文中报告错误,成员“加载”。 错误:在类型“”中找不到方法“ FSharp.Data.Runtime.BaseTypes.IJsonDocument Create(System.IO.TextReader,System.String)”。 在目标程序集中可用的类型中可能缺少此方法。
我该如何摆脱呢?
我不确定这是问题所在,但可能有助于给出示例文件的绝对路径。 解决相对路径是类型提供程序中不断出现问题的根源。 您可以执行以下操作:
[<Literal>]
let sample = __SOURCE_DIRECTORY__ + "/exampleConfig.json"
type ServiceConfig =
JsonProvider< sample, EmbeddedResource="MyService, e
xampleConfig.json", SampleIsList = true >
我偶然发现了答案。 一定是某些Visual Studio索引变了。 我的解决方案中的另一个项目存在另一个问题,因此我只是对git进行了“紧急提交”,使用git clean -fdx
清理了本地工作副本,然后重新加载了解决方案,重建了所有内容,错误消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.