Have you tried using a non-stub assembly?
-mike

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Matthew
Merrill
Sent: Thursday, February 06, 2003 5:54 PM
To: [EMAIL PROTECTED]
Subject: Re: Remoting fails with Enumeration fields

Unless a more eloquent solution to the enumeration is found or Microsoft
fixes this bug, I have employed a workaround.

Change the method prototype to an integer and insert a cast to int on
the
client.  The method now becomes:

public string doSomething(int weekday)
{
   Console.WriteLine("doSomething(DayOfWeek) called");
   string dayName = Enum.GetName(typeof(DayOfWeek), weekday);
   if (dayName == null)
      throw new ArgumentOutOfRangeException
         ("DayOfWeek", weekday, "Invalid Weekday");

}


The client call now becomes:
string result2 = doSomething((int) Server.DayOfWeek.Monday);

if a client call is made by passing an integer value directly (we lose
the
advantage of restricting values on the input) and the value is not in
the
enumeration list, an exception will be generated.

This is a little bit messy and forces a change to the interface at this
point.  Not exactly what I wanted to do, but at least it works for now.

Matthew Merrill
CCH Incorporated
On Thu, 6 Feb 2003 12:04:50 -0800, Michel Liesmons
<[EMAIL PROTECTED]> wrote:

>I'm quite sure it must be a bug and indeed have something to do with
>serialization.
>I experienced the same problem only yesterday.
>Only I was not using remoting but calling from an .exe a method in a
>serviced component. This implies cross process access and thus
>serialization. The error message I got was exactly the same.
>I tried marking the enum explicitly as serializable but to no avail.
>Since it was only a test .exe I added an overload with the parameter
>defined as an int. Calling the method from other serviced components in
the
>same Application (process) works just fine.
>I'll just ask my customer to log the problem, they have a support
contract.

Reply via email to