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

Exception when results are int option #139

Closed
lefthandedgoat opened this issue Jun 24, 2015 · 10 comments
Closed

Exception when results are int option #139

lefthandedgoat opened this issue Jun 24, 2015 · 10 comments

Comments

@lefthandedgoat
Copy link

I get this stack

Could not load file or assembly 'FSharp.Core' or one of its dependencies. The system cannot find the file specified.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at FSharp.Data.ISqlCommand Implementation..ctor(Connection connection, Int32 commandTimeout, String sqlStatement, Boolean isStoredProcedure, SqlParameter[] parameters, ResultType resultType, ResultRank rank, FSharpFunc`2 rowMapping, String itemTypeName) in C:\Users\mitekm\Documents\GitHub\FSharp.Data.SqlClient\src\SqlClient\ISqlCommand.fs:line 122

Below query reproduces it

select count(*) as cnt from
(
  select 1 as number
  union all
  select 2 as number
  union all
  select 3 as number
) as numbers

This actually works no problem in Mono (OSx), but on Windows (Win7, vs 2013) it does not.

Stack points to this line of code:
https://github.com/fsprojects/FSharp.Data.SqlClient/blob/master/src/SqlClient/ISqlCommand.fs#L122

I downloaded the code and added it to my project to debug, and the value of itemTypeName is Microsoft.FSharp.Core.FSharpOption1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], FSharp.Core` when the exception occurs.

I have tried without luck:
Changing binding redirects in case it was a FSharpCore 4.3.0/4.3.1
Install .net 4.0 (already installed)
Install .net 4.5.2 (already installed)
Install F# 2.0

Any help is appreciated!

@dmitry-a-morozov
Copy link
Member

I cannot replicate this.
Please provide me with following information:

  1. target .NET Framework version
  2. target F# core version
  3. full path to FSharp.Core in references section of a project.

@lefthandedgoat
Copy link
Author

image

\packages\FSharp.Core.3.1.2.1\lib\net40\FSharp.Core.dll

Is this enough? I will also try to create a project that can reproduce this by itself and put it on gitub.

@dmitry-a-morozov
Copy link
Member

I never tested it with FSharp.Core that comes Nuget.
It's actually can be hard to solve problem.
See
dotnet/fsharp#23
As temporary workaround I suggest to reference FSharp.Core that shipped with Visual F# tools

@lefthandedgoat
Copy link
Author

I get the same referencing

C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll

Tomorrow I will work to create a repro project

@lefthandedgoat
Copy link
Author

This will repro it for me on my VM. I will try on my desktop PC also

https://github.com/lefthandedgoat/fsDataSQLRepro

@dmitry-a-morozov
Copy link
Member

image

@lefthandedgoat
Copy link
Author

Cry, doesn't work on my windows 8 machine either.

I will try again some more tomorrow, in a windows 10 VM maybe.

@dmitry-a-morozov
Copy link
Member

I have Windows 8.1 installed.
Is "Copy Local" on FSharp.Core reference set to true?

@lefthandedgoat
Copy link
Author

It wasnt, and it didn't even exist in the repro code. Setting to true fixes it. Adding the nuget package to the repro code and setting to true also fixes it.

Thanks.

About 50% or more of my problems with F# revolve around FSharp.Core and Proj files =(.

Thank you for your help!

@dmitry-a-morozov
Copy link
Member

When it comes to type providers it's 10x bigger problem
Once F# team will fix the bug that F# core is missing from list of referenced assemblies
I will try to change the type provider to grab types from assemblies provided in reference list.
In theory it will resolve cases like the one you just had.

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

2 participants