[Mono-list] Problem with XML-Serialization

Blackskyliner blackskyliner at live.de
Sun Jul 12 18:00:55 EDT 2009


Hi I just jumped in into mono I hope I'm in the right forum/mailinglist,
because i wrote an little server application that I wanted to run on my
linux machine. Its originally written in .NET 2.0

To exchange Messages between Server and Client I use an XML-serialized
class....
In .NET I dont get any problems but with mono I get the following exception:

 There was an error generating the XML document. > The type of the argument
object 'ChatClient.serverMessages' is not primitive.

I implemented the serverMessage in the following way:

using System;
using System.Text;

namespace ChatClient
{
    [Serializable]
    public class Message
    {
        public Message_StatusCodes statusCode;
        public messageType messageType;
        public object message;
        public DateTime time;
        public string user;

        public Message()
        {
            init();
        }

        public Message(string Username)
        {
            init();
            this.user = Username;
        }

        private void init(){
            this.statusCode = Message_StatusCodes.NULL;
            this.message = null;
            this.time = DateTime.Now;
            this.user = null;
            this.messageType = messageType.NULL;
        }

        public void Clear()
        {
            this.statusCode = Message_StatusCodes.NULL;
            this.messageType = messageType.NULL;
            this.message = null;
            this.time = DateTime.Now;
            this.user = null;
        }

        public void Clear(string Username)
        {
            this.Clear();
            this.user = Username;
        }

        public Message(Message_StatusCodes c)
        {
            init();
            this.statusCode = c;
        }
    }

    public enum Message_StatusCodes
    {
        NULL,

        Login,

        UserKicked,
        UserJoined,
        UserConnected,
        UserDisconnected,

        UserListChanged
    }

    public enum messageType{
        NULL,
        UserMessage,
        ServerMessage,
        ClientMessage
    }

    public enum serverMessages
    {
        LOGIN_ERROR_UserAlreadyExist,
        LOGIN_ERROR_UsernameReserved,
        LOGIN_OK
    }

    public enum clientMessages
    {
        Disconnect
    }
}


Why does this not deserialize in Mono but in C#?? Is there any workaround or
smth. else?

I'm thankful about every answer...
Blackskyliner
-- 
View this message in context: http://www.nabble.com/Problem-with-XML-Serialization-tp24452869p24452869.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list