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

Rolf Bjarne Kvinge rolflists at ya.com
Thu Jun 10 05:24:56 EDT 2010


Hi,

This has been fixed now in trunk (r158782). 

Rolf

> -----Mensaje original-----
> De: mono-vb-bounces at lists.ximian.com [mailto:mono-vb-
> bounces at lists.ximian.com] En nombre de Dale Ragan
> Enviado el: lunes, 31 de mayo de 2010 0:32
> Para: mono-vb at lists.ximian.com
> Asunto: [mono-vb] Using reflection to invoke a method written in VB
> throws an exception
> 
> 
> First a little background, I am currently adding MonoDevelop support to
> an
> open-source project called SpecFlow[1].  Just a quick intro to
> SpecFlow, it
> allows us to create behavior driven specification tests based off a
> common
> user story syntax called Gherkin.  It is very similar to Cucumber[2]
> for
> Ruby.
> 
> Now for the problem, we have a test case to run external steps from
> other
> assemblies and one of the assemblies is a VB compiled assembly.
> MonoDevelop
> is using the vbnc compiler that I built from svn.  Mono and MonoDevelop
> are
> built from svn also.  These step methods are invoked using reflection.
> I
> have one class and two methods in this VB project and the first one
> executes
> correctly, but the second one does not.  The only difference between
> the two
> methods, is that the method that throws the exception is decorated with
> an
> attribute called When.  The other method is decorated with an attribute
> called Then.  Of course When is a keyword in VB, therefore we surround
> it
> with [ ].  While invoking, MonoMethod throws a
> System.InvalidProgramException:  Invalid IL code in
> ExternalStepsVB.VBStepDefinitions:step2 (): IL_000f: ret at line 223
> during
> the call to InternalInvoke which is a pinvoke to a native method.  When
> I
> translate the method using C# the test passes, so there shouldn't be
> anything wrong with the code.
> 
> I decided to post here, since it is complaining about the IL and also
> to get
> feedback before submitting a bug report.  You can grab my source[3]
> from
> github and test the ExternalSteps test yourself with MonoDevelop using
> the
> NUnitTestRunner to throw the exception that I am seeing.  Let me know
> if you
> need anything else.
> 
> Thanks,
> 
> Dale
> 
> [1]: http://www.specflow.org/
> [2]: http://cukes.info/
> [3]: http://github.com/sinesignal/SpecFlow
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Using-
> reflection-to-invoke-a-method-written-in-VB-throws-an-exception-
> tp2236684p2236684.html
> Sent from the Mono - VB mailing list archive at Nabble.com.
> _______________________________________________
> Mono-vb mailing list
> Mono-vb at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-vb



More information about the Mono-vb mailing list