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 7407797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:47:24+00:00 2026-05-29T05:47:24+00:00

I have the following Type: Class Command<TData> : Base Where TData : I In

  • 0

I have the following Type:

Class Command<TData> : Base Where TData : I

In runtime this class is build (with specific TDATA) and Serialized.
I have 2 issues( I’m using V2 ):
1) When I’m adding this type to runtime modal :

var meta = this._modal.Add(type, false)
                             .Add(this.GetDMProperties(type).Select(p => p.Name)
                             .ToArray());

I get the following exception:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at ProtoBuf.Meta.TypeModel.ResolveProxies(Type type) in C:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 952
at ProtoBuf.Meta.RuntimeTypeModel.FindWithoutAdd(Type type) in C:\Dev\protobuf-net\protobuf-net\Meta\RuntimeTypeModel.cs:line 118
at ProtoBuf.Meta.ValueMember..ctor(RuntimeTypeModel model, Type parentType, Int32 fieldNumber, MemberInfo member, Type memberType, Type itemType, Type defaul
tType, DataFormat dataFormat, Object defaultValue) in C:\Dev\protobuf-net\protobuf-net\Meta\ValueMember.cs:line 75
at ProtoBuf.Meta.MetaType.AddField(Int32 fieldNumber, String memberName, Type itemType, Type defaultType, Object defaultValue) in C:\Dev\protobuf-net\protobu
f-net\Meta\MetaType.cs:line 1165
at ProtoBuf.Meta.MetaType.Add(String[] memberNames) in C:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:line 1046

2) If i try to skip it at start up and try to do it on demand like below:

if (this._modal.CanSerializeContractType(objectType) == false)
            {
                this._modal.Add(objectType, false);
                this._modal.CompileInPlace();
            }

CanSerializeContractType returns true, but in practice only the base data is serialized.

My question is what is the practice of adding this type to modal without adding all permutations on design time if possible ?

  • 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-29T05:47:26+00:00Added an answer on May 29, 2026 at 5:47 am

    I will have to investigate the first; sounds like an odd edge case bug. However, your second point ties into a conversation I had a short while ago – with the conclusion that I will add an event that is fired when a type is first seen. You would then have the opportunity during the event of configuring the type. In theory: simple; I just need to implement it. I will “bump” this forwards on my list of things…

    Side note: unless you are only working inside a single AppDomain and not writing to disk or sending over the network or between processes, you must make sure you can reliably add properties/sun-types with the same keys. Or more specifically: eithrr your GetDMaproperties method (not shown) needs some kind of fixed order, or you need an OrderBy in the LINQ. Also; that is brittle – if anyone adds/removes/renames a property, the keys will change.

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

Sidebar

Related Questions

When using ASP.net webforms my usual solution would have following type of setup -
i have a templated class, with the following definition: ImageRescaleDepth<PIXEL_TYPE_INPUT, PIXEL_TYPE_OUTPUT> This class uses
I have jar files which I constructed using command jar -cf Generic.jar /java/mypackage/*.class There
I have the following model class Command(models.Model): server = models.ForeignKey(Server) user_login = models.CharField(max_length=100) user_run
I have the following class which I am using to read in large amounts
I have the following type in wsdl (it is generated by third party tool):
I have the following code: Type type = typeof(T); foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public
I have the following case where I want to accept the following routs '/type/view/23'
Iam an F# newbie, I have following starting point: type aB = { ID:
I have come across the following type of code many a times, and I

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.