Hi, is it possible to report bugs found in MonoBasic to Bugzilla? I could not find direct link on page http://www.go-mono.com/bugs.html
Here is the bug I found: OS: Windows XP SP1, Mono version: 0.28 Title: MBas freezes when trying to compile simple QuickSort example from MSDNAA (http://www.msdnaa.net/) and consumes 100% of CPU Command Line: mbas.bat QuickSort2.vb --timestamp Results: [00:172] Loading references [00:047] References loaded [00:015] Initializing Core Types [00:141] Core Types done [00:000] Resolving tree [00:016] Populate tree [00:125] Emitting code Here Mbas freezes for long time (I was waiting 10 minutes, when I stopped it) and consumes 100% of CPU. Simple programs are compiled correctly, for example, this works: Imports System Module t0 Sub Main() Console.Out.WriteLine("test") End Sub End Module BR, Peter Gulder
' ' QuickSort VB.NET Sample Application ' Copyright �2001-2002 Microsoft Corporation. All rights reserved. ' ' MSDN ACADEMIC ALLIANCE [http://www.msdnaa.net/] ' This sample is part of a vast collection of resources we developed for ' faculty members in K-12 and higher education. Visit the MSDN AA web site for more! ' The source code is provided "as is" without warranty. ' ' ' Import namespaces Imports System Imports System.Collections Imports System.IO Imports Microsoft.VisualBasic ' Declare application class Module QuickSortApp ' Application initialization Sub Main() 'Print startup banner Console.WriteLine() Console.WriteLine("QuickSort VB.NET Sample Application") Console.WriteLine("Copyright (c)2001-2002 Microsoft Corporation. All rights reserved.") Console.WriteLine() Console.WriteLine("MSDN ACADEMIC ALLIANCE [http://www.msdnaa.net/]") Console.WriteLine() ' Describe program function Console.WriteLine("This example demonstrates the QuickSort algorithm by reading an input file,") Console.WriteLine("sorting its contents, and writing them to a new file.") Console.WriteLine() ' Prompt user for filenames Dim szSrcFile, szDestFile As String Console.Write("Source: ") szSrcFile = Console.ReadLine() Console.Write("Output: ") szDestFile = Console.ReadLine() ' Read contents of source file Dim szSrcLine As String Dim szContents As ArrayList Dim fsInput As FileStream Dim srInput As StreamReader szContents = New ArrayList() fsInput = New FileStream(szSrcFile, FileMode.Open, FileAccess.Read) srInput = New StreamReader(fsInput) szSrcLine = srInput.ReadLine() While Not IsNothing(szSrcLine) ' Append to array szContents.Add(szSrcLine) szSrcLine = srInput.ReadLine() End While srInput.Close() fsInput.Close() ' Pass to QuickSort function QuickSort(szContents, 0, szContents.Count - 1) ' Write sorted lines Dim fsOutput As FileStream Dim srOutput As StreamWriter Dim nIndex As Integer fsOutput = New FileStream(szDestFile, FileMode.Create, FileAccess.Write) srOutput = New StreamWriter(fsOutput) For nIndex = 0 To szContents.Count - 1 ' Write line to output file srOutput.WriteLine(szContents(nIndex)) Next nIndex srOutput.Close() fsOutput.Close() ' Report program success Console.WriteLine() Console.WriteLine("The sorted lines have been written to the output file.") Console.WriteLine() Console.WriteLine() End Sub ' QuickSort implementation Sub QuickSort(ByRef szArray As ArrayList, ByVal nLower As Integer, ByVal nUpper As Integer) ' Check for non-base case If nLower < nUpper Then ' Split and sort partitions Dim nSplit As Integer nSplit = Partition(szArray, nLower, nUpper) QuickSort(szArray, nLower, nSplit - 1) QuickSort(szArray, nSplit + 1, nUpper) End If End Sub ' QuickSort partition implementation Function Partition(ByRef szArray As ArrayList, ByVal nLower As Integer, ByVal nUpper As Integer) As Integer ' Pivot with first element Dim szPivot As String Dim nLeft, nRight As Integer nLeft = nLower + 1 szPivot = szArray(nLower) nRight = nUpper ' Partition array elements Dim szSwap As String While nLeft <= nRight ' Find item out of place While nLeft <= nRight If szArray(nLeft).CompareTo(szPivot) > 0 Then Exit While nLeft = nLeft + 1 End While While nLeft <= nRight If szArray(nRight).CompareTo(szPivot) <= 0 Then Exit While nRight = nRight - 1 End While ' Swap values if necessary If (nLeft < nRight) Then szSwap = szArray(nLeft) szArray(nLeft) = szArray(nRight) szArray(nRight) = szSwap nLeft = nLeft + 1 nRight = nRight - 1 End If End While ' Move pivot element szSwap = szArray(nLower) szArray(nLower) = szArray(nRight) szArray(nRight) = szSwap Return nRight End Function End Module
