我在我的应用程序中添加了全局错误处理,以捕获所有未处理的异常。我现在添加了这个功能,以便自动将bug添加到我的fogbugz帐户中。现在是我的问题。
我添加了对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发布于 2012-10-01 01:23:56
“保护级别”指的是BugReport类上的访问修饰符。
如果将类声明为Friend (Internal in C#),则同一程序集(.dll)中的其他类可以访问该类。
当您试图从另一个项目引用该类时,它是不可访问的。
您需要将Friend更改为Public。
https://stackoverflow.com/questions/12666136
复制相似问题