我正在研究用VB.net编写的现有Windows应用商店应用的更新。 我创建了一个共享的MsgBox()函数和一个“un-shared”函数(它将从共享函数运行)。我需要共享的,因为我也从另一个类运行它。完整的错误代码:
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
答案 0 :(得分:4)
您的MsgBox
函数调用自身 - 导致无限递归,因此堆栈溢出。您可能需要MsgBox
来致电MsgBox_unShared
。