[mono-vb] Using reflection to invoke a method written in VB throws an exception

Dale Ragan dale.ragan at sinesignal.com
Sat Jun 12 00:31:43 EDT 2010


> Unfortunately this patch will not be backported to 2.6, vbnc recently went
> through some major changes that can't be backported to maintenance
> releases
> (the risk of breaking something else would be too great).

I will change the code to one of the alternatives.  I guess the fix will
be included in the 2.8 release?  Also, did you create a bug report?  If
you did, what is the link?  I would like to include it in the commit
message when I make the change.

>>  I guess a work around until a patch is
>> released for users will be to write it out the long way:
>>
>> var counter = ScenarioContext.Current.Item("counter")
>> ScenarioContext.Current.Item("counter") = counter + 1
>
> This will work (except that you're mixing C# and VB here, VB doesn't have
> 'var' :) )

Doh!:)  Of course I meant to write:

    Dim counter as Int =
DirectCast(ScenarioContext.Current.Item("counter"), Integer)

Sorry I code in C# and I whipped that up pretty quick and I wasn't thinking.

> Note that the bug was only for a few very specific code sequences (this
> still worked for instance: ScenarioContext.Current("counter") += 1)

Thanks, I will use this instead, since it is similar to what was causing
the bug.

-Dale



More information about the Mono-vb mailing list