System.NullReferenceException in Microsoft.Practices.EnterpriseLibrary.Logging.dll

Topics: Exception Handling Application Block, Logging Application Block
Jun 12, 2009 at 5:49 PM

hello,

if we add a null value to exception.data and handle the exception using Enterprise lib throw a null reference expcetion. is this expected?

try
{
 Process();
}

catch (Exception ex)
{
 ex.Data.Add("TestValue", null);
 bool rethrow = ExceptionPolicy.HandleException(ex, "Log Only Policy");
 DisplayResults("**Exception has been logged. See the currently configured log destination (default is event log) for exception details.");

 if (rethrow)
 {
  throw;
 }

}


Thanks,
ASMS

Jun 15, 2009 at 9:12 AM

What version of EntLib are you using?  I tried it in 4.1 and I didn't encounter a null reference exception so the least I can say is it's not expected and it's a bug that is already fixed in 4.1.  However, no logging occured due to that exception which was handled by entlib so I think that should still be fixed.  This issue is already logged in the issue tracker so you can vote for it here - http://entlib.codeplex.com/WorkItem/View.aspx?WorkItemId=10791

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

Jun 15, 2009 at 3:57 PM

thanks for the reply... i was using EntLib 4.1. i was able to replicate the issue with the "Exception Handing with Logging Quick Start Sample".

anyway i have voted for the workitem 10791.

thanks

ASMS