【发布时间】:2019-12-01 20:52:04
【问题描述】:
我得到了一个要处理的应用程序,一个更新功能的简单工作。但是,我无法使用调试器单步执行代码来编辑函数
当点击主菜单上的搜索按钮时,程序运行良好,我可以使用调试器单步执行所有操作,直到达到这个功能:
Private Function ftnCompetitionSearch(Optional ByVal pstrCompNum As String = Nothing, Optional ByVal pstrCompYear As String = Nothing, Optional ByVal pstrCompTypeId As String = Nothing, Optional ByVal pstrBranchId As String = Nothing, Optional ByVal pstrPositionId As String = Nothing) As svcHR.Competitions()
Dim listComp As svcHR.Competitions() = Nothing
Dim myClient As svcHR.IsvcHRClient = Nothing
Try
'Perform search and display results in datagrid'
myClient = New svcHR.IsvcHRClient
listComp = myClient.ftnSearchCompetitions(pstrCompNum, pstrCompYear, pstrCompTypeId, pstrBranchId, Nothing, pstrPositionId)
Return listComp
Catch ex As Exception
Throw ex
Finally
If myClient IsNot Nothing Then myClient.Close()
End Try
End Function
'This then flows to a file called Reference.vb where this function exists:'
Public Function ftnSearchCompetitions(ByVal pstrCompNum As String, ByVal pstrCompYear As String, ByVal pstrCompTypeId As String, ByVal pstrBranchId As String, ByVal pstrLocationId As String, ByVal pstrPosTypeId As String) As svcHR.Competitions() Implements svcHR.IsvcHR.ftnSearchCompetitions
Return MyBase.Channel.ftnSearchCompetitions(pstrCompNum, pstrCompYear, pstrCompTypeId, pstrBranchId, pstrLocationId, pstrPosTypeId)
End Function
listComp = myClient.ftnSearchCompetitions(pstrCompNum, pstrCompYear, pstrCompTypeId, pstrBranchId, Nothing, pstrPositionId) 行调用了搜索方法,该方法用搜索结果填充主菜单。这是我需要更新的函数,但是如果我尝试使用调试器进入它,我会收到以下错误消息:
“无法自动进入服务器。连接到服务器计算机 'machinenameexample.ca' 失败。Microsoft Visual Studio 远程调试监视器 (MSVSMON.EXE) 似乎没有在远程计算机上运行。这可能是因为防火墙阻止了与远程计算机的通信。有关配置远程调试的帮助,请参阅帮助。"
如果我尝试进入MyBase.Channel 行,也会显示此消息。
我尝试在我的计算机上运行 MSVSMON,但它并没有改变任何东西。我已经对此进行了一些研究,但我还没有找到任何直接的解决方案,尽管它似乎是一个相当流行的问题。
【问题讨论】:
-
您希望用于调试该功能的源代码在哪里?顺便说一句,您的
Catch弊大于利-当您捕获 ex 然后抛出 ex 时,您会丢失堆栈跟踪,并且您的调用者无论如何都会看到异常,因此只需删除Catch。你真的只需要Try...Finally这样你就可以关闭你的客户端了。 -
我只需要按照程序完成该功能即可对其进行编辑。我使用调试器来做到这一点。我不确定您要的源代码是什么。另外,感谢
try-catch的提醒 -
... get to that function in order to edit it ... not sure what the source code you're asking for is ...。我在询问该功能的源代码。您似乎想编辑它,但如果您不知道源代码在哪里,您如何编辑它?据我所知,它是此类svcHR.IsvcHRClient的实例函数。你有那个类的代码还是只是一个参考?您似乎没有该代码。 -
我已经编辑了这个问题。 IsvcHRClient 中有一个名为 Reference.vb 的文件,它具有此功能,但我仍然无法进入它以找到源代码的位置,这是我在编辑代码时非常依赖的东西。我按照程序的进展来获得我想要编辑的特定功能。
-
我明白了。事实证明,我对这个功能的调查有点松懈。我已经找到了源代码,我将继续研究它。不过感谢您的回复。
标签: vb.net visual-studio xaml