Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6733227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:44:37+00:00 2026-05-26T10:44:37+00:00

I have List<HtmlAgilityPack.HtmlNode> but protobuf-net gives me error that it doesn’t have a contract.

  • 0

I have List<HtmlAgilityPack.HtmlNode> but protobuf-net gives me error that it doesn’t have a contract. How can I specify a contract for it when I don’t have the source? It actually said it couldn’t infer the type but I assume it’s because I didn’t use its attibute, right?

The default binary serializer also complains because the type is not marked as serializable.

EDIT: The error message is:

Type is not expected, and no contract can be inferred: HtmlAgilityPack.HtmlNode
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:44:38+00:00Added an answer on May 26, 2026 at 10:44 am

    Frankly, in the case of HTML I’d just store… the html – it is kinda pre-serialised! However, to answer the question:

    In protobuf-net v2, you can configure a TypeModel at runtime, which allows everything you can do via attributes and a few other tricks (in v2 the attributes just help steer the model if nothing else is specified). And because you can do all this at runtime, you dont need to change the type – and hence can apply it to models outside your control. The default model instance is RuntimeTypeModel.Default, and you can add types to the model, and configure each MetaType individually (which maps to Type). This allows you to tell it what members (properties/fields), sub-types, callbacks, etc to apply.

    If that gets too complex, you can also specify a “surrogate”, which allows you to configure a simple DTO, and use a standard conversion operator (explicit or implicit) to change between the complex model and the simple DTO model.

    For info, the significance of the default model is: that is what Serializer.* uses. However, if you use the TypeModel instance to perform serialization/deserialization you can have multiple differently configured models for the same types.

    I can’t remember the full details of HTML-agility-pack, but those are the main options available for your scenario via protobuf-net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have list of text that contain double quoate and upderscore. How can I
i have list of rows that user select and i want to delete them,
I have list of words. I type in a word misspelled. Can I query
I have list of files which contain particular patterns, but those files have been
I have list of IPs: 238.51.208.96/28 238.51.209.180-199 238.51.209.100-109 238.51.213.2-254 ... How can I easily
i have list of items IList with data that looks list this: GenId TestMode
I have List collection that is populated in specific order (the requirement is that,
I have list of rows that I have fetched using mysql_fetch_array() . Now I
I have list of comments in one array. Can I use update_all on array
I have list and the elements of the list can be selected (one at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.