472,981 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Using Enterprise Library 4.0 Exception Handling Application Block

Hi,

I have previously used EL v 3.1 Exception Handling application block
successfully. I thought I would now try to do the same with EL v 4.0. My
first experiment was to replace an exception.
I created a project and added the following references -

1/ Enterprise Library Exception Handling Application Block v 4.0
(Microsoft.Practices.EnterpriseLibrary.ExceptionHa ndling.dll)
2/ Enterprise Library Shared v 4.0
(Microsoft.Practices.EnterpriseLibrary.Common.dll)
3/ Microsoft.Practices.ObjectBuilder v 1.0.51206.0 (then I tried version 2
as well)(Microsoft.Practices.ObjectBuilder.dll)

I then used the Configuration Manager to create the app.config file and add
the
Replace Handler to my new policy.

I then added simple code in my application (see below) that uses the
ExceptionPolicy.HandleException of EL.

Unfortunately I get the error below and I can't figure out what is wrong.

Please can someone point me in the right direction. I really would
appreciate any help.

Kind regards,

Polly Anna

Application Code -

Dim i, j, k As Decimal
Dim booRethrow As Boolean

Try
i = 1
j = 0
k = i / j

Catch ex As Exception
Try
booRethrow = ExceptionPolicy.HandleException(ex, "Replace
Policy")
If booRethrow Then Throw

txtMessage.Text = ex.ToString
Catch ex2 As Exception
txtMessage.Text = ex2.ToString
End Try
End Try
End Sub
Error Message -

Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionHandlingException:
The current build operation (build key Build
Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyImpl,
Replace Policy]) failed: The type
'Microsoft.Practices.EnterpriseLibrary.ExceptionHa ndling.WCF.FaultContractWrapperException,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.WCF, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot be resolved. Please
verify the spelling is correct or that the full type name is provided.
(Strategy type
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.ConfiguredObjectStrategy,
index 2) ---Microsoft.Practices.ObjectBuilder2.BuildFailedExce ption: The
current build operation (build key Build
Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyImpl,
Replace Policy]) failed: The type
'Microsoft.Practices.EnterpriseLibrary.ExceptionHa ndling.WCF.FaultContractWrapperException,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.WCF, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot be resolved. Please
verify the spelling is correct or that the full type name is provided.
(Strategy type
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.ConfiguredObjectStrategy,
index 2) ---System.ArgumentException: The type
'Microsoft.Practices.EnterpriseLibrary.ExceptionHa ndling.WCF.FaultContractWrapperException,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.WCF, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot be resolved. Please
verify the spelling is correct or that the full type name is provided.
at
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.AssemblyQualifiedTypeNameConverter.Conver tFrom(ITypeDescriptorContext
context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(Ob ject value)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.Configuration.ReplaceHandlerData.get_Replace ExceptionType()
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.Configuration.ReplaceHandlerAssembler.Assemb le(IBuilderContext
context, ExceptionHandlerData objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.AssemblerBasedObjectFactory `2.Create(IBuilderContext
context, TConfiguration objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyEntryCustomFactory.Create(IBu ilderContext
context, ExceptionTypeData objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyCustomFactory.CreateObject(IB uilderContext
context, String name, IConfigurationSource configurationSource,
ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.ConfiguredObjectStrategy.Pr eBuildUp(IBuilderContext context)
at
Microsoft.Practices.ObjectBuilder2.StrategyChain.E xecuteBuildUp(IBuilderContext context)
--- End of inner exception stack trace ---
at
Microsoft.Practices.ObjectBuilder2.StrategyChain.E xecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp (IReadWriteLocator
locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain
strategies, Object buildKey, Object existing)
at
Microsoft.Practices.ObjectBuilder2.Builder.BuildUp[TTypeToBuild](IReadWriteLocator
locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain
strategies, Object buildKey, Object existing)
at
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.EnterpriseLibraryFactory.Bu ildUp[T](IReadWriteLocator
locator, ILifetimeContainer lifetimeContainer, String id,
IConfigurationSource configurationSource)
at
Microsoft.Practices.EnterpriseLibrary.Common.Confi guration.ObjectBuilder.LocatorNameTypeFactoryBase` 1.Create(String name)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicy.GetExceptionPolicy(Exception
exception, String policyName, ExceptionPolicyFactory factory)
--- End of inner exception stack trace ---
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicy.GetExceptionPolicy(Exception
exception, String policyName, ExceptionPolicyFactory factory)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicy.HandleException(Exception
exceptionToHandle, String policyName, ExceptionPolicyFactory policyFactory)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
at EHAB4v.Form1.cmdReplace_Click(Object sender, EventArgs e) in
C:\Documents and Settings\David Woodhouse\My Documents\Visual Studio
2008\Projects\EHAB4v\EHAB4v\Form1.vb:line 21

Jun 27 '08 #1
0 2435

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

Similar topics

2
by: belius | last post by:
Hi all, I am building an ASP.NET internet application and I am considering the opportunity to use the Exception Handling Application Block and the Logging Application Block to handle the...
0
by: Benny Ng | last post by:
Hi,All, When i deploy Enterprise library with my application ,i used XCOPY to deploy it into my test server. But when application runs, shown some error related registry. (But actually I haven't...
1
by: David Herbst | last post by:
Enterprise Library Jan 2006 with Visual Studio 2005 on Windows 2000 Server sp4. My custom exception formatter fails with a "Unable to handle exception: 'LoggingExceptionHandler'." exception. ...
9
by: reshugoyal | last post by:
Hi, I need to implement Auto Updates in my application wherein I will be installing the application using msi. First time I will be installing it through CD.( Directly running the MSI file)...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
3
by: Wade | last post by:
Hey all, Question regarding Exception Handling w/ Application Blocks. The example given (ExceptionHandlingWithLogginQuickStart) creates a DialogResult to display the error message back to the...
1
by: thejackofall | last post by:
Howdy? Good. I am getting this error when the Exception Handling Application Block when it tries to create my exception handler. Here is the error. Constructor on type...
1
by: sreedharv | last post by:
Log4Net vs Enterprise Library - Logging Application Block Please list or point to the comparison. My requirements are: - 50 to 70 web servers - Track Machine name - Extract class / method...
0
by: srizzler | last post by:
Hi All: I am trying to implement Exception Handling using Enterprise Library 3.1's Exception Handling Application Block as well as Logging Blocks. I have a windows application developed in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.