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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:25:12+00:00 2026-06-15T18:25:12+00:00

In C# we have namespaces in .proto we get from protobuf-net we do not

  • 0

In C# we have namespaces in .proto we get from protobuf-net we do not get any namespaces. So the question is how to make protobuf-net generate (and use inside) .proto files with namespacs/packages.

Example when we parsed all our project to make .proto files to connect a C++ app to our C# app we got tons of

enum AnimationCode {
   None = 0;
   Idle = 1;
   //...
}

and

enum SessionCode {
   None = 0;
   //...
}

And so when we gave that unified project .proto file to protogen compiler we got tons of

Enum type “SessionStateCode” has no value named “None”.

and

Note that enum values use C++ scoping rules, meaning that enum values
are siblings of their type, not children of it.

and no C++ code.

Point was to make it so that encoded C# message would be at least readable from C++

  • 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-15T18:25:13+00:00Added an answer on June 15, 2026 at 6:25 pm

    There is not currently any code inside protobuf-net to perform automatic name collision fixes, although I’d be interested to know if you have any proposals. Another option would be:

        enum AnimationCode {
            [ProtoEnum(Name="AnimationCode_None")]
            None = 0,
            Idle = 1
        }
    

    Here, the .proto will use AnimationCode_None when generation the scema; in fact, it will be:

    enum AnimationCode {
       AnimationCode_None = 0;
       Idle = 1;
    }
    

    I’ve checked the MetaType/ValueMember API, and it looks like currently it would be hard to set the .Name at runtime, but that could be fixed in a new release easily enough (like with this similar enum/MetaType fix) if you preferred to set them at runtime rather than decorate with attributes.

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

Sidebar

Related Questions

I have two namespaces: 1) Foo.Bar 2) Another.Foo.Bar From a class in namespace 2,
I have following XML. I was able to remove all namespaces but not able
I have observed that in C++ namespaces are very rarely used while in .Net
If I do not use any namespace my code works just fine, but when
I'm trying to use protobuf in a C# project, using protobuf-net, and am wondering
Why doesn’t Objective-C have namespaces? It seems like a simple feature that would make
is there away of getting protobuf-net protogen to wrap an existing proto in an
From other posts, it appears that if you have namespaces defined and want to
Files and directories could have different namespaces, and still be used to identify specific
I have these namespaces defined in my bootstrap file: use Doctrine\Common\ClassLoader, Doctrine\Common\Annotations\AnnotationReader, Doctrine\ODM\MongoDB\DocumentManager, Doctrine\ODM\MongoDB\Mongo,

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.