生成类型提供程序的编译时错误

时间:2018-10-20 00:44:43

标签: f# type-providers fsharp.data.sqlclient

我正在与FSharp.Data.SqlClient生成类型提供程序一起工作的SqlEnumProvider分支上遇到问题。当测试项目尝试使用提供的类型时,出现以下编译时错误:

A problem occurred writing the binary 'C:\code\FSharp.Data.SqlClient\src\SqlClient.Tests\obj\Debug\net451\SqlClient.Tests.dll': Error in pass3 for type FSharp.Data.EnumTests, error: Error in GetMethodRefAsMethodDefIdx for mref = ("Parse", "TinyIntMapping"), error: Exception of type 'Microsoft.FSharp.Compiler.AbstractIL.ILBinaryWriter+MethodDefNotFound' was thrown.

在设计时,一切似乎都按预期工作。 (我对所提供的类型有智慧,等等。)

我尝试了建议的解决方法here,但没有任何乐趣。

2 个答案:

答案 0 :(得分:1)

如何使用容器方法将所有提供的类型放入容器中,然后倒出所需的每种容器?

我在很多类型提供程序中使用了此功能,请查看iOS设计器类型提供程序以供参考:https://github.com/xamarin/fsharp-iOS-designer/blob/master/src/Xamarin.iOSProviders/iOSDesignerProvider.fs#L64-L86

答案 1 :(得分:1)

事实证明答案在SDK的示例模板中,我只是没有足够仔细地阅读它:

  • 提供者类型(例如SqlEnumProvider)应添加到执行程序集。
  • 应将根类型(例如SqlEnumProvider<"SELECT * FROM (VALUES(('One'), 1), ('Two', 2)) AS T(Tag, Value)">)添加到提供的程序集中。

在失败的代码中,我们将根类型添加到两个程序集中。