Error when trying to run F# HTML Parser
New F# program with this line of code
let results = FSharp.Data.HtmlDocument.Load("http://www.google.com/search?q=FSharp.Data")
But I get a MissingMethodException
Method not found: 'FSharp.Data.HtmlDocument FSharp.Data.HtmlDocument.Load(System.String, Microsoft.FSharp.Core.FSharpOption`1)'.
Code runs ok in VSCode, Am I missing something ?
Seems like it is having some sort of issue with the optional parameter.
let results = FSharp.Data.HtmlDocument.Load("http://www.google.com/search?q=FSharp.Data")
But I get a MissingMethodException
Method not found: 'FSharp.Data.HtmlDocument FSharp.Data.HtmlDocument.Load(System.String, Microsoft.FSharp.Core.FSharpOption`1)'.
Code runs ok in VSCode, Am I missing something ?
Seems like it is having some sort of issue with the optional parameter.
Comments
Tried on 3 different machines
Runs without error in VSCode or VStudio...
However I get a similar error then trying to use the CssSelector function from the CssSelectorExtensions module.
The error looks to me classic of a failure of c# reflection code failing to properly locate a method on a class. But I have no idea what/why such code would need to run on execution of a F# Program in Linqpad.
Have also replicated the above issue in Linqpad 6
Can anyone else confirm the error ?
@JoeAlbahari I know you are probably busy with Linqpad 6, but if you can suggest a workaround that would be very helpful until the issue can properly identified and rectified ?
//Gets the first CssSelect method (of three) from the static class and then invokes it by reflection.
[A]Microsoft.FSharp.Collections.FSharpList`1[FSharp.Data.HtmlNode] cannot be cast to [B]Microsoft.FSharp.Collections.FSharpList`1[FSharp.Data.HtmlNode]. Type A originates from 'FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'LoadFrom' at location 'C:\Users\xxx\AppData\Local\LINQPad\NuGet.FW46\FSharp.Data\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll'. Type B originates from 'FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'LoadNeither' in a byte array.
@JoeAlbahari I need a suggestion. I've tried everything I can think of.
Also, go to Query Properties, Advanced, and right-click the checkbox "Copy all NuGet references into single folder". This will bring up an assembly resolution log. Could you paste that in, too, please?