I've been trying a lot before writing this question but I couldn't find any answer for my problem.
I'm making a remoting program, It's like a store, I've implemented the .dll, the server and the client, and It is everything ok except the fact that I have a big problem related to Serialization, this is a little summary about my code.
[Serializable]
public class Almacen
{
int nusuarios_on, nusuarios_reg;
bool server_on;
ArrayList clientes_activos;
ArrayList clientes_registrados;
ArrayList productos_almacen;}
[Serializable]
public class Cliente
{
protected int id;
protected String usuario, dni;
private String contraseña;
Pedido pedido;}
[Serializable]
public class Pedido
{
ArrayList productos;
bool confirmado;
int preciototal;}
[Serializable]
public class Producto
{
private String nombre;
private int codigo, precio, unidades, stock; //Stock solo lo usamos en el almacen, y unidades solo en pedido.}
Then, I have my .dll service, in which I have a method with a 'Pedido' object passed by value in parameter, when that method is called.
public class ServicioAlmacen : MarshalByRefObject
{
private Almacen almacen;
.
.
.
public int añadirProductoAlmacen(int id, Producto p) {
if(id==1) {
if(!productoRepetido(p)) {
almacen.getProductos_almacen().Add(p);
Console.WriteLine("Añadido el producto {0} al almacen.", p.getCodigo());
return 0;
}
else {
Console.WriteLine("Intento de añadir un producto repetido.");
return -1;
}
}
else {
Console.WriteLine("Acceso denegado.");
return -2;
}
}
.
.
.
}
When this method is called in the client side, I get a SerializationException which tells me that ServiceAlmacen.Producto is NOT tagged as Serialized. I dont understand why I get that exception because I tagged every class as Serialized, any idea? Thanks.
PD: If you need my client or server code let me know and i will edit to post.