Reflection.MethodCaller bugreport

Reflection.MethodCaller bugreport

Old forum URL: forums.lhotka.net/forums/t/5929.aspx


rfcdejong posted on Wednesday, December 03, 2008

Hello,

I couldn't find the place where to send in bug reports or feature requests, so i hope you people won't mind that i post it here.

Using the DataMapper.Map() with a DataMap in the parameter it can go wrong when the DataMap has fieldnames that don't exist. Throwing the exception

Object reference not set to an instance of an object.

The MethodCaller class does a objectType.GetField(fieldName, fieldFlags) which will result into null when the field doesn't exist. I would rather like some strongly typed stuff, ofcourse that will be almost impossible since private fields won't be available. So the best possible change'll only be to raise an exception (if not suppressed) with the name of the businessobject and the field not being found.

if (!_memberCache.TryGetValue(key, out mh))
{
      
FieldInfo info = objectType.GetField(fieldName, fieldFlags);
      mh = new DynamicMemberHandle(info);
      _memberCache.Add(key, mh);
}

RockfordLhotka replied on Wednesday, December 03, 2008

Thank you, this is the perfect place to report issues.

I'll add this to the issue list.

Copyright (c) Marimer LLC