Can you show any of your XmlSerializer code here, so can understand it? I
wouldn't expect the presence of a static type to break XmlSerializer, I
admit! But also: protobuf code doesn't usually guarantee anything other
than that it should work with the corresponding protobuf library.

On Tue, 20 Aug 2019, 06:32 arun kumar, <arun.kumar...@gmail.com> wrote:

> @Marc Gravell,
>
> I auto-generated ".cs" files from each ".proto" file. . Whereever a
> message declared inside another message in proto, auto-generated cs file is
> generated as " Nested Types " and Types class is generated as static. (I
> guess , its how the generator defined)
>
> And, I am trying to convert my xml data into CS object using XMLSerializer
> , it complains
>
> There was an error reflecting type 'SCL.PC.ClientIdentifier'. --->
>> System.InvalidOperationException: SCL.PC.ClientIdentifier+Types cannot be
>> serialized. Static types cannot be used as parameters or return types.
>
>
> All I am trying to do is ,
>
> Converting XML data --> CS Object (IMessage) --> proto buf Serialize into
>> stream
>
>
>
> Is there any way, to convert the xml data to IMessageObject.. I can see
> MessageParser has ParseJson object.  Likewise, anything available for xml ?
>
>
>    var serializer = new XmlSerializer(typeof(SCL.PC.ClientIdentifier));
>
> Auto-Generated CS File :
>
> public sealed partial class ClientIdentifier :
> pb::IMessage<ClientIdentifier> {
>     private static readonly pb::MessageParser<ClientIdentifier> _parser =
> new pb::MessageParser<ClientIdentifier>(() => new ClientIdentifier());
>     private pb::UnknownFieldSet _unknownFields;
>     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
>     public static pb::MessageParser<ClientIdentifier> Parser { get {
> return _parser; } }
>
> ---
>
>     #region Nested types
>     /// <summary>Container for nested types declared in the
> ClientIdentifier message type.</summary>
>     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
>     public static partial class Types {
>       public enum Context {
>         /// <summary>
>         /// The client's identifier consists of a functional identifier
> (FID) in big-endian format.  Valid values range from 0x00000000 to
> 0xFFFFFFFF.
>         /// </summary>
>         [pbr::OriginalName("CFID")] Cfid = 0,
>         /// <summary>
>         /// The client's identifier consists of an ASCII-encoded serial
> number.
>         /// </summary>
>         [pbr::OriginalName("CSN")] Csn = 1,
>       }
>
>     }
>     #endregion
>
>   }
>
>   #endregion
>
>
> On Monday, 19 August 2019 19:56:45 UTC+5:30, Marc Gravell wrote:
>>
>> And can we see some code that actually demonstrates this problem? That
>> would really help here.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/a6a61e73-3253-4191-b2a0-27cb63d26bde%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/a6a61e73-3253-4191-b2a0-27cb63d26bde%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CAF95VAycOVwTeWhrVWJ1e2KPBjVsHeNyrfqfsp6CUadxjhmqWQ%40mail.gmail.com.

Reply via email to