Bug 1179 - Crash when using Main as an expression
Summary: Crash when using Main as an expression
Alias: None
Product: Compilers
Classification: Mono
Component: VisualBasic ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2011-10-02 15:16 UTC by Lee Millward
Modified: 2018-05-22 11:54 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Lee Millward 2011-10-02 15:16:41 UTC
Compiling the following invalid code snippet crashes VBNC:

Module Main

	Sub Foo
		Dim var as Type = Main
	End Sub
End Module

With the following error:
Unhandled exception(vbnc.InternalException): There has been an internal error in the compiler caused by the line: (5,25)
   at vbnc.Expression.ReclassifyToValueExpression() in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\Expressions\Expression.vb:line 447
   at vbnc.VariableInitializer.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\Members\VariableInitializer.vb:line 93
   at vbnc.VariableDeclaration.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\Members\VariableDeclaration.vb:line 220
   at vbnc.CodeBlock.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\Code\CodeBlock.vb:line 562
   at vbnc.MethodBaseDeclaration.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\General\MethodBaseDeclaration.vb:line 331
   at vbnc.SubDeclaration.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\Members\SubDeclaration.vb:line 118
   at vbnc.BaseObjects`1.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\General\BaseObjects`1.vb:line 63
   at vbnc.TypeDeclaration.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\TypeDeclarations\TypeDeclaration.vb:line 407
   at vbnc.AssemblyDeclaration.ResolveCode(ResolveInfo Info) in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\TypeDeclarations\AssemblyDeclaration.vb:line 159
   at vbnc.Compiler.Compile_Resolve() in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\General\Compiler.vb:line 414
   at vbnc.Compiler.Compile() in C:\My Stuff\Mono\mono-basic\vbnc\vbnc\source\General\Compiler.vb:line 530
InnerException: (Nothing)
Data.Count: 0
Commandline arguments:
There has been an internal error in the compiler caused by the line: (5,25)
Compilation took 00:00:00.9531250
Comment 1 Rolf Bjarne Kvinge [MSFT] 2018-05-22 11:54:39 UTC
Moved to: https://github.com/mono/mono-basic/issues/22