Hi, A couple of debugging hints I'd try:
Use Console.WriteLine instead of MessageBox Modify the vbnc script (which calls the vbnc.exe executable) to dump compiler parameters / code to a file and try to reproduce executing vbnc directly. Rolf > -----Original Message----- > From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- > boun...@lists.ximian.com] On Behalf Of bass...@gmail.com > Sent: sábado, 01 de agosto de 2009 2:38 > To: 'Robert Jordan'; 'mono-devel-list@lists.ximian.com' > Subject: Re: [Mono-dev] VBNC and embedding > > Robert, may I be so blunt to ask which steps you take exactly to > successfully get VB code to compile? > > I'm doing nothing too complicated, but the code is spread over multiple > classes, so what I'll do is paint a picture of what I'm currently doing > below: > > I'm on Windows XP, VS2005, mono 2.4.2.3 and using the embedding API. > > I load, "libglib-2.0-0.dll" and "mono.dll" and get a whole bunch of > procaddresses from mono.dll. > > then: > > mono_config_parse(NULL); > m_RootDomain = mono_jit_init_version("root","v2.0.50727"); > mono_security_set_mode(MONO_SECURITY_MODE_NONE); > m_MainAssembly = mono_assembly_open(&m_MainAssemblyFile); > m_MainImage = mono_assembly_get_image(m_MainAssembly); > > The main assembly contains the "compiler" code which I will be calling > from the unmanaged code using the embedding API: > > CompilerParameters m_Params = new CompilerParameters(); > m_Params.GenerateExecutable = false; > m_Params.GenerateInMemory = true; > m_Params.IncludeDebugInformation = false; > m_Params.TreatWarningsAsErrors = false; > m_Params.CompilerOptions = "/t:library"; > m_Params.ReferencedAssemblies.Clear(); > m_Params.ReferencedAssemblies.Add("mscorlib.dll"); > > CodeDomProvider m_Provider = new > Microsoft.VisualBasic.VBCodeProvider(); > CompilerResults cResults = > m_Provider.CompileAssemblyFromSource(m_Params, Script); > > Which I call using: mono_runtime_invoke(); > > Here's the (VB) script I'm trying to compile: > > imports System > imports System.Windows.Forms > > Namespace xpScript > > Class ScriptObject > > Public Sub Main() > MessageBox.Show("hello?") > End Sub > > End Class > > End Namespace > > > I tried loading a 2.0 assembly using mono_jit_init(), (to make sure the > switching to 2.0 works) but same result. > If I force loading of v1.0 or v9.0 for example, the call to the managed > compiler simply hangs in the MSVC debugger. > But when I do the above (correctly switch to 2.0) I get the VBNC_CRASH > error in the compiler results. > > The weird thing is that when I switch the CodeProvider to > CSharpProvider it works beautifully and I can compile AND execute > just about any code, using the VBCodeProvider the "script" won't even > compile. > > Do you see any obvious ommisions or mistakes in the above? > > You wouldn't happen to have a very basic working msvc solution which > simply loads an assembly and executes a VBScript do you? > > > Thanks for you help, > Bas > > > > > > -----Original Message----- > > From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel- > list- > > boun...@lists.ximian.com] On Behalf Of Robert Jordan > > Sent: Friday, July 31, 2009 17:01 P > > To: mono-devel-list@lists.ximian.com > > Subject: Re: [Mono-dev] VBNC and embedding > > > > bass...@gmail.com wrote: > > > Hi guys, > > > > > > I have successfully integrated mono as scripting engine using > > > CSharpCodeProvider and the embedding api. However, ever since mono > > > 2.0, switching to Microsoft.VisualBasic.VBCodeProvider() as the > code > > > provider will always give me VBNC_CRASH at line 0 as an error > result > > > when trying to compile a very basic piece of VB.NET code. All I do > is > > > switch the code provider (and the script code obviously). > > > > > > Is there anyone who is using the VBCodeProvider under the 2.x > runtime > > > successfully that can tell me whats going on? > > > > It works fine for me when I'm trying to compile some basic > > VB code. > > > > Are you sure that you're switching the runtime correctly to run > > on the 2.0 profile? VBCodeProvider does not support .NET 1.1. > > > > Robert > > > > _______________________________________________ > > Mono-devel-list mailing list > > Mono-devel-list@lists.ximian.com > > http://lists.ximian.com/mailman/listinfo/mono-devel-list > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list