Skip to content

Update to latest version of SDK #315

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

Merged
merged 6 commits into from
Oct 24, 2018

Conversation

samhanes
Copy link

No description provided.

@samhanes
Copy link
Author

samhanes commented Oct 20, 2018

I've confirmed that the SqlEnumProvider compiler-time issue I described on #314 is caused by the upgrade to the latest version of the TP SDK:

The provided types in SqlEnumTests.fs cause compiler errors, but work just fine at design time (i.e., intellisense works, etc.)

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

@samhanes
Copy link
Author

@samhanes
Copy link
Author

I was able to get the compile issue resolved - SqlClient.Tests now compiles. However, the tests do not run - I get an exception when trying to run xunit. When it calls GetExportedTypes() on the test assembly, I see the following exception:

System.TypeLoadException: Could not load type 'BTL' from assembly 'SqlClient.Tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the parent does not exist.
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at <StartupCode$FSI_0005>.$FSI_0005.main@()

I'm not sure what the type BTL is - I don't see any symbol called BTL in the repository or in ProvidedTypes.fs. Has anyone seen that error before?

I have confirmed that it is related to the generated types - if I comment out all references to SqlEnumProvider the tests all pass. I did have to adjust the assemblies that the provided types reference - in order to get the test project to compile at all, the provided enum types reference the provided assembly rather than the executing assembly. This is how it's done in the sample projects on the TP SDK - see the "Tweak assemblies for provided enum types" commit.

@vasily-kirichenko @smoothdeveloper @dmitry-a-morozov

@samhanes
Copy link
Author

I was able to fix the tests by changing the base type of the provided uom from None to Some typedefof<obj>.

This PR is ready for review now - my plan is to base #314 off of this branch until it is merged.

@samhanes samhanes changed the title [WIP] Update to latest version of SDK Update to latest version of SDK Oct 24, 2018
@smoothdeveloper smoothdeveloper merged commit bac5ede into fsprojects:master Oct 24, 2018
@smoothdeveloper
Copy link
Collaborator

@samhanes thanks a lot for updating the TP SDK!

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

Successfully merging this pull request may close these issues.

2 participants