Ionide-vscode-fsharp: 13.25.3 breaks FSharp.Data.Npgsql type provider

Created on 25 Aug 2018  路  13Comments  路  Source: ionide/ionide-vscode-fsharp

A recent ionide update has broken intellisense inside ionide for this type provider (confirmed on Mac and PC platforms). Reverting to 13.25.1 resolves the issue. The simplest project below causes the Npgsql type provider to give an error about a missing dll.

The type provider 'FSharp.Data.Npgsql.NpgsqlProviders' reported an error: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

The database credentials don't need to be real to trigger the problem. Minimal project to reproduce in this repo. Am testing with dotnet skd 2.1.400 and Visual studio 15.8 installed. The project has the magic workaround to allow it to compile under dotnet with other compilers at design time. The project compiles correctly and intellisense works on Visual Studio and Rider. I'm guessing there is something specific in this particular type provider that is interacting poorly with Ionide, (@dmitry-a-morozov has been looking at it), but the other IDEs don't seem to be affected. We have seen this on 4 different machines (2 PCs, 2 Macs). The only fix was reverting to older version of Ionide.

```open FSharp.Data.Npgsql

type Db = NpgsqlConnection<"Host=localhost;Username=foo;Password=bar;Database=mydb">

[]
let main argv =
0

````

bug language services

Most helpful comment

O_o... OK... ;-)

All 13 comments

@baronfel Any idea if our recent changes could caused that?

I need to check, but it's possible that we could be adding wrong references/compiler flags (like --no-framework) in a project context instead of just in a script context

@daz10000 could you attach the diagnostics output for your ionide/VSCode? There should be a command palette entry for it under F#

Of course. It was working since I downgraded to 13.25.1, so I have added that trace (still gets error because database credentials are fake but otherwise working fine). When I upgrade ionide, the other trace for the new version 13.25.3 gets the dll not found error. (let me know if you need other diagnostics).

.ionide_npgsql_broken.txt
ionide_npgsql_working.txt

The same here for different type provider having problem on .NET core (in add_AssemblyResolve method):

System.BadImageFormatException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies 
should not be loaded for execution. They can only be loaded in the Reflection-only loader context.

I just tried to downgrade to 3.25.1 and it works again. I don't know if it helps but by desperate investigation we found that different dlls are loaded in edit time and during build. The same as in @daz10000 log files - see in broken.txt there are dlls from .nuget\packages\microsoft.netcore.app\2.1.0\ref\ folder. The rest is the same - compiles ok, works in Raider, VS. I wish I could help more, but don't have a clue what could cause this.

Can you please check on the 3.25.4?

Same behavior with 3.25.4 unfortunately.

Unfortunately the same with 3.25.4.

3.25.1
image

3.25.3/4
image

To at least help a little bit, I created example .NET Core app on https://github.com/Dzoukr/OpenAPITypeProvider/tree/master/examples/NetCoreConsoleApp where you can check the error.

Hi @Krzysztof-Cieslak, just checked on 3.26.0 and error is gone! Thanks a lot, Sir! Please, @daz10000, could you check on your side?

O_o... OK... ;-)

Yes, I can happily report that 3.26.0 fixes the error for me as well.

I am fairly sure 3.29.0 recreated this problem (or something very similar). The same test project is now reporting it can't load System.Threading.Tasks.Extensions through the type provider in ionide. The code does work and the project works with visual studio. I will try reverting to the previous version when I get a chance. The only other thing I did was to switch fsac to netcore instead of net (as ionide suggested). Will also see if that changes the outcome

image

Ok, did one test. This only occurs when fsac is set to netcore and not net. That's an easy workaround for now but not sure why this would occur.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isaacabraham picture isaacabraham  路  5Comments

MikaelUmaN picture MikaelUmaN  路  5Comments

dustinmoris picture dustinmoris  路  3Comments

cartermp picture cartermp  路  4Comments

vasily-kirichenko picture vasily-kirichenko  路  6Comments