first of all thank you for the additional information that finally allowed me to reproduce the problem. Here is the result of my investigation.
Short answer: XPath is not supported on the phone. If you want to use HTML Agility Pack, use the LinqToXml features instead.
Enabling the XPath features on Windows Phone only works, as you stated, when you add a reference to the System.Xml.XPath assembly of the Silverlight 4 SDK. This is considered an unsupported workaround to add XPath support to Windows Phone which worked in the
past on 7.x (also note the warning you receive in Visual Studio when you add the reference, about unexpected behavior). In Windows Phone 8, this trick doesn't seem to work anymore (see also Mathias comment
, for example).
Apparently there now is a System.Xml.XPath assembly (version 22.214.171.124, as opposed to version 126.96.36.199 from the Silverlight SDK) that is internally used by the XAML page loader. Now when you add the Silverlight SDK version the result is a conflict between these
involved assemblies that cannot be resolved.
The problem is not related to YLAD. Here's a short test you can do: Add a new empty Windows Phone 8 class library to your Windows Phone 8 project. In that new class library, add an empty phone page. Now use the Navigate() method from within your app to navigate
to the page that is located in the class library. You will receive the exact same error then, if you have added the reference to Silverlight's System.Xml.XPath before - and in the same way it works as expected when you remove that reference. As I see it, there's
nothing I could do to prevent that error from happening, as it happens even before YLAD is successfully loaded, and every other component integrated in the same way will face the same problem.
As I mentioned above, the best solution would be not to use any of the XPath features. I do use LinqToXml in YLAD too, it works as advertised. In my tests, I didn't need to add the Silverlight System.Xml.XPath assembly for compilation; my samples compiled fine
without it and with the HTML Agility Pack referenced. Of course I don't know if additional things need to be done once you start actively using HAP or if you have added references to these features in your code.
I hope this helps. Sorry that there won't be a simpler solution to resolve this.