[mono-vb] vbnc console menu question

Andy Hume andyhume32 at yahoo.co.uk
Sun Apr 12 17:54:08 EDT 2009


There's a bug in the compiler.  The problem occurs due to:
[[
      ...   
      Dim Answer As String = MenuMethod()
      ...

   Sub MenuMethod()
   ...
]]

There is /no/ return value from a Sub.  Change the Sub to a Function.

The bug you should be logged, see http://www.mono-project.com/Bugs.  Titled
something like "Compiler crash using return from a Sub".

Andy



Jude DaShiell wrote:
> 
> Goal:
> Use menu subroutine in file menu.vb to show menu on screen then have
> tester.vb f
> ile that wraps around menu.vb print out collected response from menu.vb. 
> I trie
> d several things none of them successful but this last one was surprising. 
> I'm 
> not using G.U.I. controls since they won't work in Linux command line
> environmen
> t and generate exceptions.  Compiler is vbnc.
> 
> Results:
> ' File: tester.vb
> Option Strict On
> Imports System
> 
> Module Tester
> Sub Main()
> Dim Answer As String = MenuMethod()
> MenuMethod( )
> Console.WriteLine("Caught: " + Answer)
> End Sub
> End Module
> 
> ' File: menu.vb
> Module Menu
> Sub MenuMethod()
> While(Menuvar<>"q")
> ' clear the console.
> Console.Clear()
>  	Console.WriteLine("")
> Console.WriteLine("iching Hexagram Generator - Program Menu")
> Console.WriteLine("")
> Console.WriteLine("Read (a)bout program")
> Console.WriteLine("randomly generate (c)omputer hexagram")
> Console.WriteLine("")
> Console.WriteLine("enter (r)ecorded hexagram")
> Console.WriteLine("")
> Console.WriteLine("(q)uit program")
> Console.WriteLine("")
> Console.WriteLine("")
> Console.WriteLine("your choice (a/c/r/q): ")
> Try
> Menuvar=Console.Read()
> Catch ex As Exception
> End Try
> End While
> Return Menuvar
> End Sub
> End Module
> 
> File: typescript
> Script started on Sun 12 Apr 2009 09:58:36 AM EDT
> dashielljt at gmpexpress:~/iching6$ vbnc tester.vb menu.vb
> 
> ** (/usr/lib/mono/2.0/vbnc.exe:2169): WARNING **: Symbol file
> /usr/lib/mono/2.0/vbnc.exe.mdb has incorrect version (expected 50.0, got
> 39)
> 
> ** (/usr/lib/mono/2.0/vbnc.exe:2169): WARNING **: Symbol file
> /usr/lib/mono/gac/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll.mdb
> has incorrect version (expected 50.0, got 39)
> Visual Basic.Net Compiler version 0.0.0.5904 (Mono 2.0 - r)
> Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.
> 
> 
> /home/dashielljt/iching6/<MyGenerator> (1,1) : Error VBNC99999: Unexpected
> error: There has been an internal error in the compiler caused by the
> line: (6,36)
>    at vbnc.Expression.ReclassifyToValueExpression () [0x00000]
>    at vbnc.VariableInitializer.ResolveCode (vbnc.ResolveInfo Info)
> [0x00000]
>    at vbnc.VariableDeclaration.ResolveCode (vbnc.ResolveInfo Info)
> [0x00000]
>    at vbnc.CodeBlock.ResolveCode (vbnc.ResolveInfo Info) [0x00000]
>    at vbnc.MethodBaseDeclaration.ResolveCode (vbnc.ResolveInfo Info)
> [0x00000]
>    at vbnc.MethodDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00000]
>    at vbnc.SubDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00000]
>    at vbnc.Helper.ResolveCodeCollection (IEnumerable Collection,
> vbnc.ResolveInfo Info) [0x00000]
>    at vbnc.BaseObjects`1[vbnc.IMember].ResolveCode (vbnc.ResolveInfo Info)
> [0x00000]
>    at vbnc.TypeDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00000]
>    at vbnc.AssemblyDeclaration.ResolveCode (vbnc.ResolveInfo Info)
> [0x00000]
>    at vbnc.Compiler.Compile_Resolve () [0x00000]
>    at vbnc.Compiler.Compile () [0x00000] 
> Compilation took 00:00:03.0704570
> dashielljt at gmpexpress:~/iching6$ exit
> exit
> 
> Script done on Sun 12 Apr 2009 09:58:57 AM EDT
> 
> 
> _______________________________________________
> Mono-vb mailing list
> Mono-vb at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-vb
> 
> 

-- 
View this message in context: http://www.nabble.com/vbnc-console-menu-question-tp23011384p23015215.html
Sent from the Mono - VB mailing list archive at Nabble.com.



More information about the Mono-vb mailing list