user defined exception not caught

  • Thread starter Thread starter philipl
  • Start date Start date
P

philipl

hi,

I have a pluggin whiich throw an exception of the following user
defined exception:

public class SpellCheckException : ApplicationException
{
public SpellCheckException(string msg) : base(msg)
{
}

public SpellCheckException(string msg, Exception innerException) :
base(msg, innerException)
{
}

}

The following code in my exe(in the same directory level as my exe)
which loads the pluggin will not catch this exception in this catch
try statement, when the user defined user exception is thrown.

try
{

}
catch(SpellCheckException e)
{

}

Does anyone know why this is? When I use throw a normal system
'Exception' from the pluggin, a catch(Exception e) in my exe will
catch it properly. Know whats going on?

thx
-Philip
 
Hi,

Are you sure you are throwing the exception properly ? (You have't
copy-pasted the code which throws that exception).
I've tried the following code, using your custom exception, and it worked
perfectly:

try
{
throw new SpellCheckException("my exception");
}
catch(SpellCheckException e)
{

MessageBox.Show(e.Message);
}


hi,

I have a pluggin whiich throw an exception of the following user
defined exception:

public class SpellCheckException : ApplicationException
{
public SpellCheckException(string msg) : base(msg)
{
}

public SpellCheckException(string msg, Exception innerException) :
base(msg, innerException)
{
}

}

The following code in my exe(in the same directory level as my exe)
which loads the pluggin will not catch this exception in this catch
try statement, when the user defined user exception is thrown.

try
{

}
catch(SpellCheckException e)
{

}

Does anyone know why this is? When I use throw a normal system
'Exception' from the pluggin, a catch(Exception e) in my exe will
catch it properly. Know whats going on?

thx
-Philip

Adrian Vinca [MSFT], Developer Division
--------------------------------------------------------------------
This reply is provided "AS IS", without warranty (express or implied).

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 
Back
Top