@@ -67,9 +67,9 @@ Public Class Application
6767 If Not CheckPermission(PathTemp) Then Throw New Exception( "PCL 没有对 " & PathTemp & " 的访问权限" )
6868 Catch ex As Exception
6969 If PathTemp = IO.Path.GetTempPath() & "PCL\" Then
70- MyMsgBox( "PCL 无法访问缓存文件夹,可能导致程序出错或无法正常使用!" & vbCrLf & "错误原因:" & GetExceptionDetail(ex ), "缓存文件夹不可用" )
70+ MyMsgBox( "PCL 无法访问缓存文件夹,可能导致程序出错或无法正常使用!" & vbCrLf & vbCrLf & "错误原因:" & ex.GetDetail( ), "缓存文件夹不可用" )
7171 Else
72- MyMsgBox( "手动设置的缓存文件夹不可用,PCL 将使用默认缓存文件夹。" & vbCrLf & "错误原因:" & GetExceptionDetail(ex ), "缓存文件夹不可用" )
72+ MyMsgBox( "手动设置的缓存文件夹不可用,PCL 将使用默认缓存文件夹。" & vbCrLf & vbCrLf & "错误原因:" & ex.GetDetail( ), "缓存文件夹不可用" )
7373 Setup.Set( "SystemSystemCache" , "" )
7474 PathTemp = IO.Path.GetTempPath() & "PCL\"
7575 End If
@@ -104,6 +104,13 @@ WaitRetry:
104104 ToolTipService.PlacementProperty.OverrideMetadata( GetType (DependencyObject), New FrameworkPropertyMetadata(Primitives.PlacementMode.Bottom))
105105 ToolTipService.HorizontalOffsetProperty.OverrideMetadata( GetType (DependencyObject), New FrameworkPropertyMetadata( 8.0 ))
106106 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
107114 '设置初始窗口
108115 If Setup.Get( "UiLauncherLogo" ) Then
109116 FrmStart = New SplashScreen( "Images\icon.ico" )
@@ -136,11 +143,6 @@ WaitRetry:
136143 Setup.Load( "ToolDownloadThread" )
137144 Setup.Load( "ToolDownloadCert" )
138145 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
144146 '计时
145147 Log( "[Start] 第一阶段加载用时:" & GetTimeTick() - ApplicationStartTick & " ms" )
146148 ApplicationStartTick = GetTimeTick()
@@ -155,7 +157,7 @@ WaitRetry:
155157 FilePath = PathWithName
156158 Catch
157159 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 初始化错误" )
159161 FormMain.EndProgramForce(ProcessReturnValues.Exception)
160162 End Try
161163 End Sub
@@ -168,10 +170,20 @@ WaitRetry:
168170 '异常
169171 Private Sub Application_DispatcherUnhandledException(sender As Object , e As DispatcherUnhandledExceptionEventArgs) Handles Me .DispatcherUnhandledException
170172 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+ '正常处理
171183 e.Handled = True
172184 If IsProgramEnded Then Return
173185 FeedbackInfo()
174- Dim Detail As String = GetExceptionDetail( e.Exception, True )
186+ Dim Detail As String = e.Exception.GetDetail( True )
175187 If Detail.Contains( "System.Windows.Threading.Dispatcher.Invoke" ) OrElse Detail.Contains( "MS.Internal.AppModel.ITaskbarList.HrInit" ) OrElse Detail.Contains( "未能加载文件或程序集" ) OrElse
176188 Detail.Contains( ".NET Framework" ) Then ' “自动错误判断” 的结果分析
177189 OpenWebsite( "https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net462-offline-installer" )
0 commit comments