[Ironruby-core] mscorlib:0:in `ThrowArgumentException' error

Eduardo Blumenfeld lists at ruby-forum.com
Sat Sep 4 01:08:28 EDT 2010

Hi all,

Unfortunately it didn't work,

I believe that there is some kind of problem in mscorlib
when you try to do an eval inside a loop with active record objects.

Eduardo Blumenfeld wrote:
> Thank you Charles for the answer,
> config is an active record produced list, an array of rows brought from 
> a sql table that has one of its attributes (table column) => 
> :QuantityPer
> This is the portion of the code I'm using
> --------------
> config = Term.find_by_sql("sp_someStoredProc @someparameter=#{param1}")
> config.each { |xx| if xx[:QuantityPer].nil? then nil else
> if xx[:QuantityPer].include? '#{' then
>  xxx = xx[:QuantityPer].to_s
>  xxx = xxx[2..(xxx.size-2)]
>  puts xxx
# => "some_proc(argument,argument2)"
I see in the console the xxx variable...
if at this point I put this code:
puts "#{xxx}"
it just prints (again) the xxx variable without
evaluating it at all

if at this point I put this code instead:
aaa = eval(xxx)
then I get this error:

mscorlib:0:in `ThrowArgumentException': An item with the same key has 
already been added. (ArgumentError)
        from mscorlib:0:in `Insert'

Any pointers?

Is that an mscorlib bug?
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list