> no problem....
>
[quoted text clipped - 44 lines]
>> > Regards
>> > Palli
Hi David...
Here is a detailed description of my projects...
In Main project I have a class that impliments BaseApplicationException
[Serializable]
public class CKException : BaseApplicationException
{
public CKException(string p_sVillubod, Exception p_exVilla,string
p_sUtgafunumer, int p_nVerklidurNumer,string p_sStarfsmadurNumer, string
p_sStarfsmadurNafn) : base(p_sVillubod, p_exVilla)
{
System.Reflection.PropertyInfo pi =
p_exVilla.GetType().GetProperty("Numfber");
}
// protected constructor to de-seralize state data
protected CKerfisvillaException(SerializationInfo info, StreamingContext
context) : base (info, context)
{
// Initialize state
//some code
}
// override GetObjectData to serialize state data
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info,
StreamingContext context)
{
// Serialize this class' state and then call the base class
GetObjectData
...some code
base.GetObjectData(info, context);
}
}
}
also I have a class in this project that impliments IExceptionPublisher
public class CDSPublisher : IExceptionPublisher
{
void IExceptionPublisher.Publish(Exception exception,
NameValueCollection additionalInfo, NameValueCollectionconfigSettings)
{...}
}
Third Exception klass is called CVilla and it handles calls to function in
the CKException and CDSPublisher
public sealed class CVilla
{
// init some variables...
private CVilla() {}
private static void writeException(string p_sException,Exception
p_exException)
{
...
CKException exK = new CKException(...);
ExceptionManager.Publish(exKerfisvilla);
}
...
}
All the forms in the main project inherit a class that handles any exception
handling and if an exception is thrown, then
the parent class handles the exception. The forms call a function in the DB
project but if an exeption is thrown in that project, the
exception is not catched in the Main project? CVilla class is never ref. in
the db project and there is no exception handling there!
I can use Reflection to use the CVilla class but it must be another smarter
way to handle exception in large solutions. I want to be able
to catch all errors in one place.
here is the app.config ..
<configuration>
<configSections>
<section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
</configSections>
<exceptionManagement mode="on">
<publisher mode="on" assembly="kerfi" type="kerfi.CDSPublisher" />
</exceptionManagement>
</configuration>
Hope this is what you are looking for....
> Where are you catching the exception? Where are you writing to the
> management block? These two lines of code don't show me anything that I can
[quoted text clipped - 48 lines]
> >> > Regards
> >> > Palli
David Levine - 03 Nov 2004 12:32 GMT
This shows me the class structure, which appears ok. It does not show where
the code has implemented its try-catch clauses. Some things to check are:
are all threads of execution wrapped in a try-catch? Have you tried
subscribing to the UnhandledException handler as a backstop? Are all
assemblies in the release build installed the same way they are in the debug
build? Is there any code that is compiled out in the Release build? Does the
exception management block have sufficient privileges to publish when
running in the release build?
Also, when you say the parent class handles the exception, what does this
mean?
As an example of what I am referring to, for any thread of execution you
should have something like this..(forgive me if this is too obvious)
void SomeMethod(object state)
{
try
{
}
catch(Exception ex)
{
ExceptionManager.Publish(ex);
}
}
> Hi David...
>
[quoted text clipped - 154 lines]
>> >> > Regards
>> >> > Palli
P?ll ?lafsson - 03 Nov 2004 12:56 GMT
Hi
First of all I want to thank you for your patient...
What I ment with the parent is every form inherit a special form that has a
function that opens the form and inside that function is the try, catch
public virtual void OpenForm()
{
try
{
... code that opens and init. the form
}
catch (Exception e)
{
CVilla.writeException(e);
}
}
I will take a look at you hints and try to resolve the problem that way...
Thanks for all you info and once again you patiant?
Regards
Palli
> This shows me the class structure, which appears ok. It does not show where
> the code has implemented its try-catch clauses. Some things to check are:
[quoted text clipped - 107 lines]
> > <configSections>
> > <section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectio
> > nHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
> > </configSections>
[quoted text clipped - 68 lines]
> >> >> > Regards
> >> >> > Palli