Bug 30885 - compiler crash on object initializer
Summary: compiler crash on object initializer
Alias: None
Product: Compilers
Classification: Mono
Component: VisualBasic ()
Version: unspecified
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2015-06-08 02:18 UTC by Joachim
Modified: 2015-06-08 07:56 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 Joachim 2015-06-08 02:18:45 UTC
I am developing an application on Windows with VS 2013 and then trying to compile the same on my Banana Pro running lubuntu. However the compiler crashed. I tried to strip down the problem to about one page:

Imports System
Imports System.Globalization
Imports System.IO
Imports System.Net
Imports System.Net.Security
Imports System.Net.Sockets
Imports System.Text
Imports Microsoft.VisualBasic
Imports Microsoft.Win32

Class DomainConfig
    Public Domain As String
    Public Server As String
    Public User As String
    Public Password As String
End Class

Class Module1
    Shared Sub main()

        Dim DomainConfigs As Collection = New Collection()
        DomainConfigs.Add(New DomainConfig With {.Domain = "domain1", .Server = "server1", .User = "user1", .Password = "pw1"}, "keys1".ToUpperInvariant)

    End Sub 'Main

End Class 'MailDeamon

the compiler crashes at DomainConfigs.Add...

vbnc -v test.vb
Visual Basic.Net Compiler version (Mono 3.0 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.

vbnc : Command line : warning VBNC2009: the option v was not recognized - ignored
/home/bananapi/smtp2imap/test.vb (25,50) : error VBNC90019: Expected ')'.
/home/bananapi/smtp2imap/test.vb (25,50): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
   at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
   at vbnc.Parser.ParseInvocationOrIndexExpression(vbnc.ParsedObject Parent, vbnc.Expression First)
   at vbnc.Parser.ParseIdentifier(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExponent(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseUnaryPlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMultDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseIntDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMod(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParsePlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseConcat(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseBitshift(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseComparison(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseNot(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseAnd_AndAlso(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseOr_OrElse_Xor(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExpression(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseCodeBlock(vbnc.ParsedObject Parent, Boolean IsOneLiner)
   at vbnc.Parser.ParseSubDeclaration(vbnc.TypeDeclaration Parent, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
   at vbnc.Parser.ParseClassDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
   at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Compiler.Compile_Parse()
   at vbnc.Compiler.Compile()
   at vbnc.Compiler.Compile(System.String[] CommandLine)
   at vbnc.Main.Main(System.String[] CmdArgs)
/home/bananapi/smtp2imap/test.vb (25,50) : error VBNC90019: Expected 'End'.
/home/bananapi/smtp2imap/test.vb (27,12) : error VBNC90019: Expected 'Class'.
/home/bananapi/smtp2imap/test.vb (29,10) : error VBNC30203: Identifier expected.
There were 4 errors and 1 warnings.
Compilation took 00:00:03.2304250

For the stripped down version I haven´t tested whether it really compiles and works with VS 2013.

Best regards,
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-06-08 07:56:00 UTC
This is because you're using an object initializer ("New DomainConfig _With_"), and our VB complier doesn't support that (we only support VB8 (VS2012), and object initializers were introduced in VB9 (VS2013)).