0
我已将全局错误处理添加到我的应用程序中,以处理全部未处理的异常。我现在刚刚添加了将bug自动添加到我的fogbugz帐户的功能。现在这是我的问题。未声明引用的DLL?
我添加了对dll的引用,还必须添加库的导入声明。这样做后,代码显示没有错误。虽然只要我去调试代码或建立它,我得到这个错误:
'BugReport'未被声明。由于其保护级别,它可能无法访问。
我在做什么与某种保护有关?这一切都在我的applicationevents.vb类中。
我已经在另一个项目中尝试了相同的代码,它的工作原理没有错误,所以我知道它不是代码。我只是不知道它是什么?我必须在应用程序设置中更改某些内容吗?反正这里是代码。我用隐私信息替换了字符串。
Imports FogBugz
Namespace My
' The following events are available for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Private Sub MyApplication_UnhandledException(ByVal _
sender As Object, ByVal e As _
Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) _
Handles Me.UnhandledException
'TO DO: SET THESE VALUES BEFORE CALLING THIS METHOD!
Dim url As String = "StackOverFlowDemoString"
'example: http://localhost/fogbugz/scoutSubmit.asp
Dim user As String = "StackOverFlowDemoString"
'existing FogBugz User
Dim project As String = "StackOverFlowDemoString"
'existing FogBugz project
Dim area As String = "StackOverFlowDemoString"
'existing FogBugz area
Dim email As String = "StackOverFlowDemoString"
'email address of the customer who reports the bug
Dim defaultMessage As String = "Bug has been submitted. Every bug submitted helps us make this software that much better. We really do appreciate it."
'the message to return to the user if no Scout Message is found for an existing duplicate bug
Dim forceNewBug As Boolean = False
'If set to true, this forces FogBugz to create a new case for this bug, even if a bug with the same description already exists.
'************************************************************************************
'send the bug we created:
BugReport.Submit(url, user, project, area, email, forceNewBug, _
defaultMessage, e.Exception, True, "{0}.{1}.{2}.{3}", True)
' If the user clicks No, then exit.
e.ExitApplication = _
MessageBox.Show(e.Exception.Message & _
vbCrLf & "Oops! It looks like we have encountered a bug. A bug report has been sent to the developers, so they can have it fixed in a jiffy. Continue?", "An Error has occured.", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question) _
= DialogResult.No
End Sub
End Class
End Namespace
这是一个控制台应用程序?你的项目是否依赖于其他库? – codingbiz
为什么你有C#和vb.net标签? –
将客户端的.NET Framework目标版本从客户端更改为完整,然后重试。 –