protobuf-net | Clone of the protobuf-net SVN repository | Serialization library

 by   mdavid C# Version: Current License: Non-SPDX

kandi X-RAY | protobuf-net Summary

kandi X-RAY | protobuf-net Summary

protobuf-net is a C# library typically used in Utilities, Serialization applications. protobuf-net has no bugs, it has no vulnerabilities and it has low support. However protobuf-net has a Non-SPDX License. You can download it from GitHub.

Clone of the protobuf-net SVN repository
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              protobuf-net has a low active ecosystem.
              It has 14 star(s) with 5 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              protobuf-net has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of protobuf-net is current.

            kandi-Quality Quality

              protobuf-net has 0 bugs and 0 code smells.

            kandi-Security Security

              protobuf-net has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              protobuf-net code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              protobuf-net has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              protobuf-net releases are not available. You will need to build from source code and install.
              It has 862 lines of code, 0 functions and 426 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of protobuf-net
            Get all kandi verified functions for this library.

            protobuf-net Key Features

            No Key Features are available at this moment for protobuf-net.

            protobuf-net Examples and Code Snippets

            No Code Snippets are available at this moment for protobuf-net.

            Community Discussions

            QUESTION

            protobuf Error when converting List<> to stream: No serializer for type
            Asked 2022-Feb-23 at 04:41

            I'm trying to do something that I think should be simple: Convert a List into a stream.

            ...

            ANSWER

            Answered 2022-Feb-23 at 04:41

            You have to add ProtoContract to your class like this:

            Source https://stackoverflow.com/questions/71231311

            QUESTION

            ProtoBuf-Net error: No serializer defined for type of inner class
            Asked 2021-Nov-29 at 14:05

            When using protobuf-net, I have a class Data decorated with [ProtoContract] attribute, which defines an inner class. Members of that type should be serialized as well.

            ...

            ANSWER

            Answered 2021-Nov-29 at 14:05

            You just need to annotate NestedData with [ProtoContract]:

            Source https://stackoverflow.com/questions/70121233

            QUESTION

            protobuf-net 2.4.0 for .NET Standard 2.0 not fully compatible
            Asked 2021-Nov-17 at 17:47

            I built the protobuf-net 2.4.0 project for .Net Standard 2.0 but the portability-analyzer tool shows only 92% of compatibility because of the below details.

            Questions are:

            1. Can I use it in every .NETCore, .NETFramework, and .NET projects anyway? (I already found this and this posts, but with the test just described I'd like to be sure it's so)
            2. Is there a protobuf-net version fully compatible with .Net Standard 2.0?
            ...

            ANSWER

            Answered 2021-Nov-17 at 17:47

            It is, confusingly, impossible to talk about compatibility with .NET Standard, unless you mean "lowest common denominator", which: most people don't. What matters is what you actually run it on. You mention .NET Framework and .NET Core - and it should.work just fine there. If you were using it on Unity or Xamarin (mobile etc), the answer is more complicated.

            Source https://stackoverflow.com/questions/70005067

            QUESTION

            How do I enable protobuf-net.BuildTools OneOf support via project file?
            Asked 2021-Nov-11 at 18:14

            The documentation seems to indicate this should be possible but I'm not having any luck getting this working as described.

            net5.0 project, protobuf-net (3.0.101) and protobuf-net.BuildTools(3.0.101) are the only NuGet references

            simple .proto file defined as:

            ...

            ANSWER

            Answered 2021-Nov-11 at 18:14

            Short version: there was an error in the tool bundling; I have fixed this, and with an imminent build (currently working through the CI build), this should be resolved; the config in the question now works, with the additional output in the C#:

            Source https://stackoverflow.com/questions/69916950

            QUESTION

            Protobuf-net - How to use oneof
            Asked 2021-Oct-20 at 14:33

            I did a quick search about the usage of oneof in Protobuf-net and it appears it's supported as of v2.3.0, but I can't for the life of me find any examples on exactly how one would use it!

            My requirements are pretty simple, and maybe this can also be solved with [ProtoInclude] but I'm not quite sure exactly how this would work. I've got the following class:

            ...

            ANSWER

            Answered 2021-Oct-20 at 14:33

            The way to play with this is to take the message from the MS example you cite, and run it through protogen to see what it does - which we can do very conveniently here: https://protogen.marcgravell.com/ (note I'm adding syntax = "proto3"; at the top of the file, which is omitted in the MS example).

            This gives us, among other things:

            Source https://stackoverflow.com/questions/69647655

            QUESTION

            Serialization / Desealization via protobuf-net between C# and Java
            Asked 2021-Oct-20 at 12:13

            I have 2 applications using protobuf in between. First one (C#) using protobuf-net with serializable object VisualSettings:

            ...

            ANSWER

            Answered 2021-Oct-20 at 12:13

            This is happening because of the inheritance, basically; inheritance isn't a concept that protobuf directly supports, so protobuf-net models inheritance via nested sub-objects; to avoid some complexity, when serializing this, protobuf-net always starts by writing the inheritance parts first - so: when serializing BasePaintHolder, it might serialize field 400 (the sub-type data for BaseSmokePaintHolder), then field 1 (materialId). This means that when it comes to deserialize, it has an obvious construction path, i.e. by the time it gets field data, it has already constructed the final concrete type.

            This is fine, for protobuf-net to protobuf-net scenarios, but when we work with the same data in Java, it doesn't know or care about this, and elects to serialize in ascending field order, i.e. field 1, then field 400. It is explicit in the specification that fields may be out of order, but Java can choose to do whatever it wants.

            So: now we take that data back to protobuf-net, and we see field 1 first; at that point, we have no clue what the final type will be, and nowhere (yet) to stick the data. With no better options, the library tries to use the base type BasePaintHolder as a placeholder until it can make better decisions, but it turns out that this type is abstract, so: even that fails.

            So: that's the why, and some back-story. What can we do?

            Well, the first thing we could try might be to remove the abstract, making it technically constructable. To prevent external code accidentally creating instances, you might also make the constructors protected, internal, or private protected (which means the intersection of protected and internal). We could also try using the SkipConstructor=true modifier on [ProtoContract].

            If that doesn't work: it might be necessary to basically work with 2 different object models; one that is simple - essentially more like the Java version, perhaps by running your schema through https://protogen.marcgravell.com/ - and one that has the inheritance; use the simple version for deserialization (and optionally serialization, although that shouldn't matter), and then re-map the data in your own code to the actual model. The other option is for me to figure out a way of doing all this magically and automatically; which: isn't a small job.

            Source https://stackoverflow.com/questions/69645098

            QUESTION

            Equivalent for MyMessageType::GetDescriptor()->file()->DebugString()?
            Asked 2021-Oct-05 at 10:06

            In C++, I'm using the call mentioned in the title to obtain the definition of a message in textual form, similar to what you would write in a .proto file. How would I do this with protobuf-net? The goal is to store message definitions in a kind of message registry. But maybe there are other possibilities to represent a message definition at runtime? (a representation of a definition that can be compared).

            ...

            ANSWER

            Answered 2021-Oct-05 at 10:06

            protobuf-net has a Serializer.GetProto API (or a RuntimeTypeModel.GetSchema API - they're the same thing with slightly different inputs); however, note that this is only an approximation of any original schema - meaning: if you do start from .proto via protobuf-net's schema parsing tools, we don't currently store the original schema anywhere, so anything we generate is a best-efforts reconstruction only.

            Source https://stackoverflow.com/questions/69448045

            QUESTION

            Protobuf-Net Cannot Deserialize Record Without Parameterless Constructor
            Asked 2021-Sep-25 at 02:03

            Consider the following code example; I want to be able to serialize (which works fine) and deserialize (which doesn't work) the Account record using protobuf-net:

            ...

            ANSWER

            Answered 2021-Sep-25 at 02:03

            The properties of a record are, by default, init-only, and as such can actually be set by reflection by protobuf-net. Thus your Account record can be deserialized by protobuf-net by bypassing the constructor as explained in this answer by Marc Gravell to Does protobuf-net support C# 9 positional record types?.

            Since you are initializing the contract for Account in runtime, modify your initialization code as to set MetaType.UseConstructor = false as follows:

            Source https://stackoverflow.com/questions/69055980

            QUESTION

            Attempting to post data serialized using Protocol Buffers fails when serializing
            Asked 2021-Sep-10 at 22:32
            In Brief

            When attempting to serialize an object using Google's Protocol Buffers I get the following error:

            Type is not expected, and no contract can be inferred:

            More Detail

            I have three projects:

            1. DotNet Standard 2.0 Library project with a *.proto file
            2. DotNet Framework 4.8 WebAPI
            3. DotNet 5 Test application
            DotNet Standard 2.0 Library project with a *.proto file

            The Library contains a *.proto file. This contains several different message objects, each with properties that are either strings or int32. There's two "wrapper" objects, one named Request (and the other Response). There's nothing obviously complicated.

            The NuGet packages for this Library are:

            ...

            ANSWER

            Answered 2021-Sep-10 at 22:32

            In protobuf, when working with a .proto, there are two sets of tools involved:

            1. the schema parser/code generator
            2. the runtime library

            Now, what we also need to know is that there are multiple implementations of protobuf in .NET-land; relevant to this question, there is the Google implementation, and protobuf-net (there are others, but they don't relate to this question).

            What I think you've done is: you've used the Google tools for step 1 ("protoc") but protobuf-net for step 2. The tools for 1 and 2 need to match: Google and Google is fine; protobuf-net and protobuf-net is fine - but not crossovers.

            So, either:

            a. use the Google runtime library instead of protobuf-net ("Google.Protobuf", as a nuget package), or b: use protobuf-net's schema tools and code gen (see https://protobuf-net.github.io/protobuf-net/contract_first.html, including the links at the bottom for other options)

            If I'm right in my hunch, please let me know - I'll try to make protobuf-net recognize this scenario and at least offer suitable guidance

            Source https://stackoverflow.com/questions/69136587

            QUESTION

            Serializing Unknown Sub-Types With Protobuf-Net
            Asked 2021-Sep-03 at 19:06

            I'm trying to get my head around protobuf-net at the moment, and found this article on being able to serialize sub-types: How to Serialize Inherited Class with ProtoBuf-Net

            Effectively this suggests that the base type needs to know about the sub-type:

            ...

            ANSWER

            Answered 2021-Sep-03 at 19:06
            1. Yes, there is a full API for this under RuntimeTypeModel, including callbacks for auto-discovery during runtime rather than ahead of time

            However!

            No, it can't work with unknown subtypes unless you mean: by ignoring the subtype aspect completely and just treating it as though it were the known type.

            Source https://stackoverflow.com/questions/69049078

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install protobuf-net

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/mdavid/protobuf-net.git

          • CLI

            gh repo clone mdavid/protobuf-net

          • sshUrl

            git@github.com:mdavid/protobuf-net.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Serialization Libraries

            protobuf

            by protocolbuffers

            flatbuffers

            by google

            capnproto

            by capnproto

            protobuf.js

            by protobufjs

            protobuf

            by golang

            Try Top Libraries by mdavid

            crtmpserver

            by mdavidC++

            SuperSocket

            by mdavidC#

            aforge.net

            by mdavidC#

            NuGet4Mono

            by mdavidShell