@@ -67,9 +67,9 @@ Public Class Application
67
67
If Not CheckPermission(PathTemp) Then Throw New Exception( "PCL 没有对 " & PathTemp & " 的访问权限" )
68
68
Catch ex As Exception
69
69
If PathTemp = IO.Path.GetTempPath() & "PCL\" Then
70
- MyMsgBox( "PCL 无法访问缓存文件夹,可能导致程序出错或无法正常使用!" & vbCrLf & "错误原因:" & GetExceptionDetail(ex ), "缓存文件夹不可用" )
70
+ MyMsgBox( "PCL 无法访问缓存文件夹,可能导致程序出错或无法正常使用!" & vbCrLf & vbCrLf & "错误原因:" & ex.GetDetail( ), "缓存文件夹不可用" )
71
71
Else
72
- MyMsgBox( "手动设置的缓存文件夹不可用,PCL 将使用默认缓存文件夹。" & vbCrLf & "错误原因:" & GetExceptionDetail(ex ), "缓存文件夹不可用" )
72
+ MyMsgBox( "手动设置的缓存文件夹不可用,PCL 将使用默认缓存文件夹。" & vbCrLf & vbCrLf & "错误原因:" & ex.GetDetail( ), "缓存文件夹不可用" )
73
73
Setup.Set( "SystemSystemCache" , "" )
74
74
PathTemp = IO.Path.GetTempPath() & "PCL\"
75
75
End If
@@ -104,6 +104,13 @@ WaitRetry:
104
104
ToolTipService.PlacementProperty.OverrideMetadata( GetType (DependencyObject), New FrameworkPropertyMetadata(Primitives.PlacementMode.Bottom))
105
105
ToolTipService.HorizontalOffsetProperty.OverrideMetadata( GetType (DependencyObject), New FrameworkPropertyMetadata( 8.0 ))
106
106
ToolTipService.VerticalOffsetProperty.OverrideMetadata( GetType (DependencyObject), New FrameworkPropertyMetadata( 4.0 ))
107
+ '设置网络配置默认值
108
+ ServicePointManager.Expect100Continue = False
109
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
110
+ ServicePointManager.DefaultConnectionLimit = 10000
111
+ ServicePointManager.UseNagleAlgorithm = False
112
+ ServicePointManager.EnableDnsRoundRobin = True
113
+ ServicePointManager.ReusePort = True
107
114
'设置初始窗口
108
115
If Setup.Get( "UiLauncherLogo" ) Then
109
116
FrmStart = New SplashScreen( "Images\icon.ico" )
@@ -136,11 +143,6 @@ WaitRetry:
136
143
Setup.Load( "ToolDownloadThread" )
137
144
Setup.Load( "ToolDownloadCert" )
138
145
Setup.Load( "ToolDownloadSpeed" )
139
- '网络配置初始化
140
- ServicePointManager.Expect100Continue = True
141
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
142
- ServicePointManager.DefaultConnectionLimit = 1024
143
- ServicePointManager.UseNagleAlgorithm = False
144
146
'计时
145
147
Log( "[Start] 第一阶段加载用时:" & GetTimeTick() - ApplicationStartTick & " ms" )
146
148
ApplicationStartTick = GetTimeTick()
@@ -155,7 +157,7 @@ WaitRetry:
155
157
FilePath = PathWithName
156
158
Catch
157
159
End Try
158
- MsgBox(GetExceptionDetail(ex, True ) & vbCrLf & "PCL 所在路径:" & If ( String .IsNullOrEmpty(FilePath), "获取失败" , FilePath), MsgBoxStyle.Critical, "PCL 初始化错误" )
160
+ MsgBox(ex.GetDetail( True ) & vbCrLf & "PCL 所在路径:" & If ( String .IsNullOrEmpty(FilePath), "获取失败" , FilePath), MsgBoxStyle.Critical, "PCL 初始化错误" )
159
161
FormMain.EndProgramForce(ProcessReturnValues.Exception)
160
162
End Try
161
163
End Sub
@@ -168,10 +170,20 @@ WaitRetry:
168
170
'异常
169
171
Private Sub Application_DispatcherUnhandledException(sender As Object , e As DispatcherUnhandledExceptionEventArgs) Handles Me .DispatcherUnhandledException
170
172
On Error Resume Next
173
+ '触发页面的 Dispatcher
174
+ If FrmMain?.PageLeft IsNot Nothing AndAlso TypeOf FrmMain.PageLeft Is IDispatcherUnhandledException Then
175
+ CType (FrmMain.PageLeft, IDispatcherUnhandledException).DispatcherUnhandledException(sender, e)
176
+ If e.Handled Then Return
177
+ End If
178
+ If FrmMain?.PageRight IsNot Nothing AndAlso TypeOf FrmMain.PageRight Is IDispatcherUnhandledException Then
179
+ CType (FrmMain.PageRight, IDispatcherUnhandledException).DispatcherUnhandledException(sender, e)
180
+ If e.Handled Then Return
181
+ End If
182
+ '正常处理
171
183
e.Handled = True
172
184
If IsProgramEnded Then Return
173
185
FeedbackInfo()
174
- Dim Detail As String = GetExceptionDetail( e.Exception, True )
186
+ Dim Detail As String = e.Exception.GetDetail( True )
175
187
If Detail.Contains( "System.Windows.Threading.Dispatcher.Invoke" ) OrElse Detail.Contains( "MS.Internal.AppModel.ITaskbarList.HrInit" ) OrElse Detail.Contains( "未能加载文件或程序集" ) OrElse
176
188
Detail.Contains( ".NET Framework" ) Then ' “自动错误判断” 的结果分析
177
189
OpenWebsite( "https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net462-offline-installer" )
0 commit comments