Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile-time error when using SqlEnumProvider after upgrading to latest version of SDK #270

Closed
samhanes opened this issue Oct 20, 2018 · 3 comments

Comments

@samhanes
Copy link
Contributor

Description

After upgrading FSharp.Data.SqlClient to the latest version of the SDK, I am seeing compile-time errors for tests using SqlEnumProvider, which is a generative provider. At design time, the provided types are working as expected.

The error at compile time:

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.

I also see the following in the output:

1>output error FS0073: error : One of your modules expects the type 'FSharp.Data.EnumTests.TinyIntMapping' to be defined within the module being emitted.  You may be missing an input file
1>output error FS0073: error : The local field Items was referenced but not declared
1>output error FS0073: error : One of your modules expects the type 'FSharp.Data.EnumTests.TinyIntMapping' to be defined within the module being emitted.  You may be missing an input file

Repro steps

  1. Fetch the branch used here: Update to latest version of SDK FSharp.Data.SqlClient#315

  2. Run build.fsx, type provider will build but tests will fail to compile.

  3. Open Tests.sln and observe that design-time behavior in SqlEnumTests.fs is as expected.

Expected behavior

SqlClient.Tests project should compile.

Actual behavior

Error when compiling SqlClient.Tests.

Known workarounds

None

Related information

  • Windows 10 Pro 10.0.17134
  • Referencing commit 7d57cd4 of TypeProviders.SDK files
  • net451
@sergey-tihon
Copy link
Member

Is it possible to create Test for this repo with TP that provide enums?
I see that @Dzoukr is also interested in such sample/test #264

@Dzoukr
Copy link

Dzoukr commented Oct 22, 2018

Thanks for pinging me - I updated #264 with snippet of my usage, but as written there - there must be cleaner way.

@samhanes
Copy link
Contributor Author

samhanes commented Oct 22, 2018

I was able to resolve this issue - we were incorrectly adding both the root types and the provider type to the executing assembly. After updating usage to match the example in the template, the compiler error is resolved.

I'm now seeing a different issue, but it may not be related - going to investigate a bit more before I close this. Please don't spend any time on this for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants