1

我正在对用 VB.net 编写的现有 Windows 应用商店应用程序进行更新。我创建了一个共享 MsgBox() 函数和一个“非共享”函数(将从共享函数运行)。我需要共享的,因为我也从另一个班级运行它。完整的错误代码:

An unhandled exception of type 'System.StackOverflowException' occurred in Calculator World.exe
The program '[4360] Calculator World.exe: Managed (v4.0.30319)' has exited with code -2147023895 (0x800703e9)

这是 MsgBox 代码:

''' <summary>
''' Shows a message box with a Close button.
''' 
''' NOTE: Run "MainPage.MessageBoxDone = false" before running this function!!!
''' </summary>
''' <param name="text">The text to show in the message box.</param>
Public Shared Sub MsgBox(ByVal text As String)'<--- error is occurring  ether here 
    MsgBox(text)                          ' <--- or here
End Sub

Private Sub MsgBox_unShared(ByVal txt As String)
    Canvas_MsgBox.Visibility = Windows.UI.Xaml.Visibility.Visible
    Label_MsgBox.Text = txt
End Sub
4

1 回答 1

4

您的MsgBox函数调用自身 - 导致无限递归,因此堆栈溢出。你可能打算MsgBox打电话给MsgBox_unShared.

于 2012-11-25T14:30:15.720 回答