检查了一下,新版的错误报错机制更加精准,但是原来的e参数貌似发生变化,原来可用的自定义报错现在都会出现致命错误,导致程序直接退出,暂时屏蔽了就没事了,不知是哪里发生变化了?
'函数调用0===================
'Functions.Execute("项目捕获错误前执行",e)
'20160824项目捕获错误前执行,用于错误引导
'e.Cancel :逻辑型,设为True将禁止系统显示错误信息.
'函数调用1===================
Dim e As object = args(0)
err_Event = e.Event '返回发生错误的事件名称
err_简明信息 = e.Message1 '返回简明错误信息
err_详细信息 = e.Message2 '返回详细错误信息
err_ex = e.ex '返回发生的错误,一般用户不需要使用此参数.
Dim s As String
s = "【事件名称】:" & err_Event
s &= _hl & "【简明信息】:" & err_简明信息
s &= _hl & "【详细信息】:" & _hl & err_详细信息 & _hl
s &= "【ex】:" & _hl & Functions.Execute("捕获错误输出",err_ex)
msgbox(s)
'函数调用0========================
'Functions.Execute("捕获错误输出",ex,[s],[是否弹出警告])
'返回:"error:" & ex.Message [& _hl & args(1)]
'ex:错误的对象
's:自定义错误提醒
'[是否弹出警告],默认为false
'函数调用1========================
'Return "error:捕获错误"
Dim Ists As Boolean = False
Dim ex As system.SystemException = args(0)
Dim s As String
s &= "Message:" & ex.Message
s &= _hl & "Source:" & ex.Source
s &= _hl & "HelpLink:" & ex.HelpLink
's &= _hl & "Data:" & ex.Data
If ex.Data.Count > 0 Then
Dim tmp As String
For Each de As System.Collections.DictionaryEntry In ex.Data
tmp &= de.Key.ToString() & "'" & de.Value
Next
s &= _hl & "ex.data:" & _hl & tmp
End If
If ex.InnerException IsNot Nothing Then
s &= _hl & "InnerException:" & ex.InnerException.ToString( )
End If
s &= _hl & "TargetSite:" & ex.TargetSite.ToString( )
s &= _hl & "StackTrace:" & ex.StackTrace
If args.length > 1
s = "系统自动报错:" & _hl & args(1) & _hl & s
Else
s = "系统自动报错:" & _hl & s
End If
Dim 弹出警告 As Boolean = False
If args.length>2
弹出警告 = args(2)
End If
If 弹出警告 Or Ists
ClipBoard.SetText(s)
MessageBox.Show(s)
Else
output.show(s)
End If
If args.length > 1
Return "error:" & ex.Message & _hl & args(1)
Else
Return "error:" & ex.Message
End If