Skip to content

Nicer error message when ArgumentOutOfRangeException exceptions are thrown #6

@GoogleCodeExporter

Description

@GoogleCodeExporter
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#11
3 and 
http://code.google.com/p/fast-member/source/browse/FastMember/TypeAccessor.cs#16
8 and 

Original issue reported on code.google.com by mattd...@gmail.com on 2 May 2012 at 5:00

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions