html-agility-pack icon indicating copy to clipboard operation
html-agility-pack copied to clipboard

LoadHtml() throws exception in Xamarin Forms app

Open janniksam opened this issue 7 years ago • 4 comments

I'm trying to use the nuget package in a .NET standard library 2.0 within a Xamarin Forms Android app.

Whenever I call the method: "document.LoadHtml(htmlString);", I get the following exception:

{System.Reflection.TargetException: Object of type 'NInterpret.InterpretedObject' doesn't match target type 'System.Collections.Generic.IEnumerable1[NInterpret.InterpretedObject]' at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet1[T] inTries, Microsoft.FSharp.Core.FSharpOption1[T] lastException) [0x0020c] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 at NInterpret.Interpreter.interpret (System.Object[] args) [0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption1[T] byRefTarget, System.Object target, System.Boolean virtualCall) [0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall) [0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet1[T] inTries, Microsoft.FSharp.Core.FSharpOption1[T] lastException) [0x03c6e] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException) [0x0013c] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0 }

Was anyone else able to use it with Xamarin Forms?

janniksam avatar May 01 '18 15:05 janniksam

Hello @janniksam ,

Seem to be the same error as here: https://stackoverflow.com/questions/49218577/htmldocument-load-throws-object-not-matched-exception-when-running-through-xamar

Do you think you could send us a project example with this issue?

We will try to look at it.

Best Regards,

Jonathan

JonathanMagnan avatar May 01 '18 19:05 JonathanMagnan

It seems to be the same issue. I am also using the player. I tried it without the nuget and with the latest source code directly, didn't help.

This is a cut part from my original project, please don't get mad by the chaos I created there. :D ETFChecker.zip

janniksam avatar May 01 '18 19:05 janniksam

Thank,

We will try to investigate it at the start of next week.

Best Regards,

Jonathan

JonathanMagnan avatar May 04 '18 15:05 JonathanMagnan

I disabled the Live Player as described in the stackoverflow question. Its working, so thats a workaround for now.

janniksam avatar May 05 '18 02:05 janniksam