Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Bug in SimpleDataProtal

$
0
0

I'm working with CSLA 4.5.601 and recently found out a bug in the Create of SimpleDataPortal. (I did something wrong but exception was hard to track because of this)

Exception was catched as expected to line 91:
catch (Exception ex) {
  ...
  throw 
DataPortal.NewDataPortalException(...

And after that run the finally:
finally{
    ApplicationContext
.DataPortalActivator.FinalizeInstance(obj.Instance);
}

But because obj was null exception was thrown from the finally block and the exception from the try/catch was 'lost'.

I've added a null check in the finally block which could prevent an issue like this in the future
finally{
  if (obj !=null)
  ApplicationContext
.DataPortalActivator.FinalizeInstance(obj.Instance);
}

Would this be a nice fix?


Viewing all articles
Browse latest Browse all 764

Trending Articles