Export to GitHub

fast-member - issue #6

Nicer error message when ArgumentOutOfRangeException exceptions are thrown


Posted on May 2, 2012 by Happy Kangaroo

If you change the code from

il.Emit(OpCodes.Ldstr, "name"); il.Emit(OpCodes.Newobj, typeof(ArgumentOutOfRangeException).GetConstructor(new Type[] { typeof(string) })); il.Emit(OpCodes.Throw);

To this:

il.Emit(OpCodes.Ldarg, 2); il.Emit(OpCodes.Newobj, typeof(ArgumentOutOfRangeException).GetConstructor(new Type[] { typeof(string) })); il.Emit(OpCodes.Throw);

It'll shown you the actual Argument name that is causing the issue, at the moment it just says the parameter name is "name"

This could be changed here http://code.google.com/p/fast-member/source/browse/FastMember/TypeAccessor.cs#113 and http://code.google.com/p/fast-member/source/browse/FastMember/TypeAccessor.cs#168 and

Comment #1

Posted on Aug 16, 2014 by Grumpy Horse

sddh

Status: New

Labels:
Type-Defect Priority-Medium