Facing run time exception when i am trying to write exception to Database from Windows application

Posted by Vinayakpk under C# on 7/4/2017 | Points: 10 | Views : 161 | Status : [Member] | Replies : 1

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, ClientExceptionPolicy]) failed: Object reference not set to an instance of an object. (Strategy type ConfiguredObjectStrategy, index 2)

I have been facing this exception when i am implementing exception handling in windows application, in which i need to achieve - Write the exception message to Daatabase

Please find below lines of code

catch (Exception ex)

string exeptionMessage = ex.Message;
ClientException cex = ex as ClientException;

string errorId = default(string);
ExceptionPolicy.HandleException(ex, "ClientExceptionPolicy");
errorId = ex.Data["HandlingInstanceID"].ToString();


Exception is thowing in this perticula line

ExceptionPolicy.HandleException(ex, "ClientExceptionPolicy");

I have added all corresponding Dll.


Posted by: Jitendrasoft09 on: 7/7/2017 [Member] [MVP] Starter | Points: 25

Check your dll which you added whether this version support or you need to add with respective project version dlls.

Example, if you have the old dll of visual studio like 2015 etc and you try to add in new version then it seems will not work. try to find it versions and add accordingly.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Vinayakpk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response