Nov 12, 2010 at 3:08 PM

Hi Throb,

I am trying to migrate to the last version, and I just discovered that the NullReferenceException in the lambda expressions are now thrown.

Is OnException((NullReferenceException ex) => false) the only way to handle this ?

Vincent BOUZON 

Nov 12, 2010 at 5:44 PM

Hi Vincent,

The latest source version is way not stable yet. If you are looking for a fix for the ConcurrentHashtable libraries you can just use the new ones with the existing 'official' Obtics release, or your adapted one (for silverlight 4).

The obtics version i'm working on now will support exception handling. In line with that the automatically inserted code to check for null references will be removed. Two reasons to remove this code is that 1 it had quite a negative impact on performance and 2 it assumed that the default value of the returned type would always be the proper fallback value in case a null reference was encountered.

The OnException((ExceptionType e) => fallbackValue) method will be the way to handle exceptions. Better still is not to allow exceptions to happen.

In case of null reference exceptions it is best to prevent properties, fields or function return values from becomming null in the first place. Second best would be to check for null values in code. Only as last resort I would use OnException((NullReferenceException ex)=>false). This is because throwing and catching exceptions is a very expensive process.



Nov 14, 2010 at 1:22 PM

Hi Thomas,

Thank you for your reply, I remain so on version "hacked" provided on this topic :