2

I'm working on upgrading FSharp.Data.SqlClient to the latest version of the Type Provider SDK and I'm seeing an error when using generated types. The test project, which references numerous generated types, compiles just fine, but when I attempt to run the xunit tests I get 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 refers to - I don't see any symbol with that name anywhere in the test or in the type provider source. And I've confirmed that the issue is related to generated types - if I comment out all references to SqlEnumProvider but leave references to erased types, the tests all pass.

Sam Hanes
  • 273
  • 2
  • 7

1 Answers1

0

Found an issue with the units-of-measure generated types - the base type of those provided types was None which was causing the error when reflecting over the assemblies types. Changing the base type to Some typedefof<obj> did the trick and now all the tests are passing.

Incidentally, the mysterious BTL type came from data in the test database, which seems obvious in retrospect.

Sam Hanes
  • 273
  • 2
  • 7