Exception Handling...

Hi all,
I wonder how Exception is handled by .NET.
here is my problem..
I've a .NET component(C# dll) and i'm using it in .NET clients.Now when an exception is thrown or an exception occurred in my component,the code where actually the exception occurs opens in the Client project and it shows my component class completely.This is really bad as you as it just exposes my component code.
One thing is,when there is any exception occurred in Framework class library components,the exception is thrown in the client project.But in my case it is opposite.
Please clarify...
Thanks,
Suresh.
[629 byte] By [sureshsundar007] at [2007-12-16]
# 1
Hi,
To avoid exceptions being thrown in your component. You could try using the try...catch...throw approach...
try {
...Code to be validated
} catch (e as Exception) {
...Catch the Error
...Throw it to the Client
throw(e);
}

cheers,
Paul June A. Domag
PaulDomag at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Yes..
i'm not using try/catch..but when i throw exception also ..the same is the result..
this is my code..
if (licenseExpired)
{
throw new Exception("License expired.Please register.");
}
now this must be thrown in the client..instead it opens my Component code in the client project(i'm using VS .NET 2002) and shows the exception there...
Thanks,
Suresh.
}
sureshsundar007 at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
Hi,
Hmmm. Are you attaching your dll as a project to the client? Or as a compiled dll...
Also try compiling it as a Release instaed of Debug...
I currently don't have visual studio in front of me...
I'll look into it first thing I get home...Big Smile

cheers,
Paul June A. Domag

PaulDomag at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified