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

  • SEARCH
  • Home
  • 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 8559693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:06:45+00:00 2026-06-11T16:06:45+00:00

I am getting the following error message when trying to serialize List<Tuple<string, Type, object>>

  • 0

I am getting the following error message when trying to serialize List<Tuple<string, Type, object>>: No Serializer defined for type: System.Type

I tried both, just serializing the above collection or serializing a class that has the same collection defined as protoMember. Both result in the same error message.

Is this a non-supported type? I assume it is supported and I overlooked something else but maybe I am incorrect?

Thanks for any pointers that may help resolve this…

  • 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-06-11T16:06:46+00:00Added an answer on June 11, 2026 at 4:06 pm

    Edit:

    Support for Type serialization is included in r580


    protobuf-net is intended to serialize your data, not your implementation; Type is an implementation detail. Strictly speaking, it wouldn’t be hugely hard to add (some of the implementation-specific details already essentially end up storing Type info, via the assembly-qualified-name), but: it isn’t a key scenario, and in many ways is not something I would encourage you to serialize – the whole point of protocol buffers is that you can load the data on any platform, with version tolerance a key feature. Storing Type information violates both of these.

    It should also be noted that most other serializers (except perhaps BinaryFormatter, which already breaks every rule of platform/version-tolerance) will also refuse to serialize a Type; XmlSerializer, DataContractSerializer, JavaScriptSerializer etc all throw an exception for this scenario (I just checked them).

    Additionally: object is even less supportable, unless you use the DynamicType feature.


    Here’s how it could be done via a surrogate on Type:

    using ProtoBuf;
    using ProtoBuf.Meta;
    using System;
    using System.Runtime.Serialization;
    
    static class Program
    {
        public static void Main(string[] args)
        {
            // register a surrogate for Type
            RuntimeTypeModel.Default.Add(typeof(Type), false)
                                    .SetSurrogate(typeof(TypeSurrogate));
            // test it
            var clone = Serializer.DeepClone(new Foo { Type = typeof(string) });
        }
    }
    
    [ProtoContract]
    class TypeSurrogate
    {
        [ProtoMember(1)]
        public string AssemblyQualifiedName { get; set; }
        // protobuf-net wants an implicit or explicit operator between the types
        public static implicit operator Type(TypeSurrogate value)
        {
            return value==null ? null : Type.GetType(value.AssemblyQualifiedName);
        }
        public static implicit operator TypeSurrogate(Type value)
        {
            return value == null ? null : new TypeSurrogate {
                AssemblyQualifiedName  = value.AssemblyQualifiedName };
        }
    }
    
    [DataContract]
    public class Foo
    {
        [DataMember(Order=1)]
        public Type Type { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following error when trying to convert HL7v3 to HL7v2 The message
I am getting the following error message: Method range of object _worksheet failed when
I'm getting the following error message in my httpd error log while trying to
I'm getting the following error message in Chrome and firefox while trying to implement
I'm trying to use util-constant for ioc but I'm getting the following error message:
I was getting the following error message while trying to debug my code: Not
I keep getting the following error message when trying to access the personal website
I am getting the following error message when trying to execute a GET REST
I keep getting the following error message when trying to UPDATE one of my
I am getting the following error message when trying to access devices connected by

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.