472,363 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

Problem with Exception management block

Hi

I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I
can't get it to work in RELEASE mode? If I run the project in debug mode
the block works fine but when I run the exe file it doesn't catch any
errors?

Does anyone know what my problem might be?

Regards
Palli
Jul 21 '05 #1
6 1957
Can you provide a short sample which demonstrates the problem? I've not had
any problems with it myself.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:e7**************@TK2MSFTNGP12.phx.gbl...
Hi

I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement?
I
can't get it to work in RELEASE mode? If I run the project in debug mode
the block works fine but when I run the exe file it doesn't catch any
errors?

Does anyone know what my problem might be?

Regards
Palli

Jul 21 '05 #2
no problem....

I have 2 project, one that is the main project and one database project.
In the main project I have a class that impliments the IExceptionPublisher
and there I the write the Publish function? The main project ref. the
database project.

My problem is when an error is thrown in database project, the exception
class, in main project, doesn't catch the error? Works in debug mode but
not in release mode???

Exemple:
public void MyFunction()
{
MyDataAdapter.Update(MyDataSet.MyDataTable); -- thows an error
MyDataSet.MyDataTable.AcceptChanges();
}
When I try to run this function in the database project, an error is thrown
because I cant insert a NULL in one field.

What I dont understand is why its works fine in Debug but not in Release??
Do I have to change some settings?

Please let me know if you need more information

Very best regards
Palli
"David Levine" <no****************@wi.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Can you provide a short sample which demonstrates the problem? I've not had any problems with it myself.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:e7**************@TK2MSFTNGP12.phx.gbl...
Hi

I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I
can't get it to work in RELEASE mode? If I run the project in debug mode the block works fine but when I run the exe file it doesn't catch any
errors?

Does anyone know what my problem might be?

Regards
Palli


Jul 21 '05 #3
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
evaluate.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
no problem....

I have 2 project, one that is the main project and one database project.
In the main project I have a class that impliments the IExceptionPublisher
and there I the write the Publish function? The main project ref. the
database project.

My problem is when an error is thrown in database project, the exception
class, in main project, doesn't catch the error? Works in debug mode but
not in release mode???

Exemple:
public void MyFunction()
{
MyDataAdapter.Update(MyDataSet.MyDataTable); -- thows an
error
MyDataSet.MyDataTable.AcceptChanges();
}
When I try to run this function in the database project, an error is
thrown
because I cant insert a NULL in one field.

What I dont understand is why its works fine in Debug but not in Release??
Do I have to change some settings?

Please let me know if you need more information

Very best regards
Palli
"David Levine" <no****************@wi.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Can you provide a short sample which demonstrates the problem? I've not

had
any problems with it myself.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:e7**************@TK2MSFTNGP12.phx.gbl...
> Hi
>
> I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? > I
> can't get it to work in RELEASE mode? If I run the project in debug mode > the block works fine but when I run the exe file it doesn't catch any
> errors?
>
> Does anyone know what my problem might be?
>
> Regards
> Palli
>
>



Jul 21 '05 #4
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.ExceptionManagem ent.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionMana gement" />
</configSections>

<exceptionManagement mode="on">

<publisher mode="on" assembly="kerfi" type="kerfi.CDSPublisher" />
</exceptionManagement>
</configuration>

Hope this is what you are looking for....

"David Levine" <no****************@wi.rr.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
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 evaluate.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
no problem....

I have 2 project, one that is the main project and one database project.
In the main project I have a class that impliments the IExceptionPublisher and there I the write the Publish function? The main project ref. the
database project.

My problem is when an error is thrown in database project, the exception
class, in main project, doesn't catch the error? Works in debug mode but not in release mode???

Exemple:
public void MyFunction()
{
MyDataAdapter.Update(MyDataSet.MyDataTable); -- thows an
error
MyDataSet.MyDataTable.AcceptChanges();
}
When I try to run this function in the database project, an error is
thrown
because I cant insert a NULL in one field.

What I dont understand is why its works fine in Debug but not in Release?? Do I have to change some settings?

Please let me know if you need more information

Very best regards
Palli
"David Levine" <no****************@wi.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Can you provide a short sample which demonstrates the problem? I've not

had
any problems with it myself.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:e7**************@TK2MSFTNGP12.phx.gbl...
> Hi
>
> I have a problem with the

Microsoft.ApplicationBlocks.ExceptionManagement?
> I
> can't get it to work in RELEASE mode? If I run the project in debug

mode
> the block works fine but when I run the exe file it doesn't catch any
> errors?
>
> Does anyone know what my problem might be?
>
> Regards
> Palli
>
>



Jul 21 '05 #5
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);
}
}

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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.ExceptionManagem ent.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionMana gement" />
</configSections>

<exceptionManagement mode="on">

<publisher mode="on" assembly="kerfi" type="kerfi.CDSPublisher" />
</exceptionManagement>
</configuration>

Hope this is what you are looking for....

"David Levine" <no****************@wi.rr.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
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
evaluate.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
> no problem....
>
> I have 2 project, one that is the main project and one database
> project.
> In the main project I have a class that impliments the IExceptionPublisher > and there I the write the Publish function? The main project ref. the
> database project.
>
> My problem is when an error is thrown in database project, the
> exception
> class, in main project, doesn't catch the error? Works in debug mode but > not in release mode???
>
> Exemple:
> public void MyFunction()
> {
> MyDataAdapter.Update(MyDataSet.MyDataTable); -- thows an
> error
> MyDataSet.MyDataTable.AcceptChanges();
> }
> When I try to run this function in the database project, an error is
> thrown
> because I cant insert a NULL in one field.
>
> What I dont understand is why its works fine in Debug but not in Release?? > Do I have to change some settings?
>
> Please let me know if you need more information
>
> Very best regards
> Palli
>
>
> "David Levine" <no****************@wi.rr.com> wrote in message
> news:%2****************@TK2MSFTNGP14.phx.gbl...
>> Can you provide a short sample which demonstrates the problem? I've
>> not
> had
>> any problems with it myself.
>>
>> "Páll Ólafsson" <pa***********@skyrr.is> wrote in message
>> news:e7**************@TK2MSFTNGP12.phx.gbl...
>> > Hi
>> >
>> > I have a problem with the
> Microsoft.ApplicationBlocks.ExceptionManagement?
>> > I
>> > can't get it to work in RELEASE mode? If I run the project in debug
> mode
>> > the block works fine but when I run the exe file it doesn't catch
>> > any
>> > errors?
>> >
>> > Does anyone know what my problem might be?
>> >
>> > Regards
>> > Palli
>> >
>> >
>>
>>
>
>



Jul 21 '05 #6
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

"David Levine" <no****************@wi.rr.com> wrote in message
news:uZ**************@TK2MSFTNGP15.phx.gbl...
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);
}
}

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
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.ExceptionManagem ent.ExceptionManagerSectio nHandler,Microsoft.ApplicationBlocks.ExceptionMana gement" />
</configSections>

<exceptionManagement mode="on">

<publisher mode="on" assembly="kerfi" type="kerfi.CDSPublisher" />
</exceptionManagement>
</configuration>

Hope this is what you are looking for....

"David Levine" <no****************@wi.rr.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
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
evaluate.

"Páll Ólafsson" <pa***********@skyrr.is> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
> no problem....
>
> I have 2 project, one that is the main project and one database
> project.
> In the main project I have a class that impliments the

IExceptionPublisher
> and there I the write the Publish function? The main project ref. the
> database project.
>
> My problem is when an error is thrown in database project, the
> exception
> class, in main project, doesn't catch the error? Works in debug mode

but
> not in release mode???
>
> Exemple:
> public void MyFunction()
> {
> MyDataAdapter.Update(MyDataSet.MyDataTable); -- thows an
> error
> MyDataSet.MyDataTable.AcceptChanges();
> }
> When I try to run this function in the database project, an error is
> thrown
> because I cant insert a NULL in one field.
>
> What I dont understand is why its works fine in Debug but not in

Release??
> Do I have to change some settings?
>
> Please let me know if you need more information
>
> Very best regards
> Palli
>
>
> "David Levine" <no****************@wi.rr.com> wrote in message
> news:%2****************@TK2MSFTNGP14.phx.gbl...
>> Can you provide a short sample which demonstrates the problem? I've
>> not
> had
>> any problems with it myself.
>>
>> "Páll Ólafsson" <pa***********@skyrr.is> wrote in message
>> news:e7**************@TK2MSFTNGP12.phx.gbl...
>> > Hi
>> >
>> > I have a problem with the
> Microsoft.ApplicationBlocks.ExceptionManagement?
>> > I
>> > can't get it to work in RELEASE mode? If I run the project in debug > mode
>> > the block works fine but when I run the exe file it doesn't catch
>> > any
>> > errors?
>> >
>> > Does anyone know what my problem might be?
>> >
>> > Regards
>> > Palli
>> >
>> >
>>
>>
>
>



Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: M. v.d. Bogaard | last post by:
Hi, I am trying to publish some custom Publisher Exceptions using the Exception Management Building Block. When an exception is thrown my application crashes and I get the following error in the...
1
by: Steve O'maley | last post by:
I currently have the Exception Management Application Block working in my base directory, but when I create pages in a subfolder the Exception Management Application Block is never executed. The...
1
by: Abelardo Vacca | last post by:
Hello, Could anyone point out advantages and disadvantages of Apache's Log4net and Microsoft's Exception Management Application Block? I am leaning towards log4net, but I've read it can give...
1
by: Andy | last post by:
Hi All, I'm basically just trying to get started with the Exception Management Application Block and am having some technical difficulties. All I want to do to begin with is create a simple...
5
by: PCC | last post by:
I am using the Exception Managment Application Block on Windows Server 2003 Enterprise and .NET v1.1. If I use the block with an ASP.NET web wervice or in a web application I get the following...
7
by: Lucas | last post by:
Hi, I have an ASP.Net application written with VS.Net 2002 (Net FWK 1.0). This Web Application uses Exception Management Application Block to log Events to Windows Event Log. We registered the...
6
by: Páll Ólafsson | last post by:
Hi I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I can't get it to work in RELEASE mode? If I run the project in debug mode the block works fine but when I run the...
1
by: Ellis Yu | last post by:
Dear All, I used VB.Net to write an application which use the exception management in Application Block as error handling. When I deploy the application in the client machine, it's fine. However...
1
by: =?Utf-8?B?QnJldHQgT3NzbWFu?= | last post by:
I'm trying to set up a custome e-mail publisher for a web app using the Microsoft Exception Management Application Block for .NET sample app. Our app already uses the Exception Management Block,...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.