Throwing an exception
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Charlie (VIP)
Hi guys,

I have a little trouble throwing an exception in a remoting service. I'm
calling a xyz Method passing by ref a DataTable, in the remoting service
method I'm processing this DataTable using a for{} statement, and when I find
an error then a set one custom column named errorStatus on TRUE and then I
throw the exception. If I run this service local (not remoting mode) the
DataTable passing by ref keep the status, but If I run it using remoting the
DataTable don't keep the status.

Check the follow code:

class remotingservice : MarshallbyRef
{
remotingservice()
{}

public void xyz(ref DataTable data)
{
for (int i = 0; i < data.Count; i++)
{
data.Index = 0;
// some internal process to know if the row has an error
if (errorexist)
{
data.OnError = True;
break;
}
}

if (data.OnError)
{
throw new System.Exception("");
}
}
}
--
Carlos Redondo
..Net Developer
Reply to this message...
 
    
Lord2702
Wed. Sep. 01, 2004 10:05 PM PT

Derive your exception class from ApplicationException, IDisposable, and
ISerializable interfaces, apply proper methods, i.e. protected
Dispose(true)/ and Dispose. and for ISerializable, GetDataObject, and a
protected ctor. In short, use custom serialization of your exception class,
and try throwing it from remoting object, you will get the DataTable object.

Good Luck.

"Charlie" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.ApplicationException
System.Data.DataTable
System.Exception
System.IDisposable
System.Runtime.Serialization.ISerializable




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com