D
Divideetimpera
Guest
Alright, so I have a functioning application for which Im doing testing. Im currently running it through multiple machines with different settings.
On one particular PC, when executing the following code on ButtonClick:
Adds registry key DoNotAllowIE10 with 0x00000001 dword entry to zone2_1 in registry which blocks Internet Explorer 10 from deploying on local machine
############################ WRITE CODE #############################################################
Dim zone2_1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0" #
My.Computer.Registry.SetValue(zone2_1, "DoNotAllowIE10", "0x00000001") #
#######################################################################################################
Its generating the following exception in the windows event logs:
Faulting application name: *** IE8.0CT build 1.3 Alpha.exe, version: 1.3.0.0, time stamp: 0x51e94f19 * where *** is company name
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18015, time stamp: 0x50b83c8a
Exception code: 0xe0434352
Fault offset: 0x0000c41f
Faulting process id: 0xd08
Faulting application start time: 0x01ce848dbdd0b6e4
Faulting application path: C:\*****************\Data\build 1.3\bin\Release\**** IE8.0CT build 1.3 Alpha.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: 1b040a7b-f081-11e2-862b-00219b399594
and this is the .NET runtime error generated in the eventviwer as well:
And the following .NET exception:
Application: **** IE8.0CT build 1.3 Alpha.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Security.SecurityException
Stack:
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])
at ****_IE80CT.My.MyApplication.Main(System.String[])
Now I have unhandled exceptions taken care of through the following in my ApplicationEvents.vb:
Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
My.Application.Log.WriteException(e.Exception,
TraceEventType.Critical,
"Application resumed functions at " &
My.Computer.Clock.LocalTime.ToString)
e.ExitApplication = False
End Sub
And the event viewer switch enabled in app.config obviously.
Heres the button actions encapsulated in a CatchTryFinally block of code:
###################################
APPLY UPDATE BLOCKER BUTTON START #
###################################
IE 10 BLOCK BUTTON, blocks Internet Explorer 10 from deploying on local machine
Private Sub blockIE10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles blockIE10.Click
AddHandler calling IE10Blocker, shows timed loading form prior to execution of code
#############################################################
Dim applyblocker As New IE10Blocker #
AddHandler applyblocker.FormClosed, AddressOf LoadingDone2 #
applyblocker.StartPosition = FormStartPosition.CenterScreen # CODE REVISION NEEDED!!!
applyblocker.Show() #
Me.Enabled = False #
#############################################################
CONTINUING, CODE THAT MODIFIES FILES ON USER-MACHINE SHALL BE MARKED AS WRITE CODE
################################## EXCEPTIONS HANDLED (2) #######################################################
Exceptions handled in Try Statement:
System.AccessViolationException
Try
Adds registry key DoNotAllowIE10 with 0x00000001 dword entry to zone2_1 in registry which blocks Internet Explorer 10 from deploying on local machine
############################ WRITE CODE #############################################################
Dim zone2_1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0" #
My.Computer.Registry.SetValue(zone2_1, "DoNotAllowIE10", "0x00000001") #
#######################################################################################################
Attempts to catch any System.AccessViolationException
Catch ex As System.AccessViolationException
Catch ex As System.Security.SecurityException
Finally allows continuation of code after exception is logged in windows event log, application will not exit, user will be prompted of failure
Finally
Logic that shows True or False based on registry key/entry existence
If My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0") Is Nothing Then
success2 = False
End If
End Try
End Sub
shows success or failed prompt for apply update blocker button
Private Sub LoadingDone2(ByVal sender As Object, ByVal e As System.EventArgs)
If success2 = True Then
blocker_applied.Show()
Else
blocker_failed.Show()
End If
Me.Enabled = True
End Sub
#################################
APPLY UPDATE BLOCKER BUTTON END #
#################################
In my opinion, I should have the unhandled exception throwing in the eventviewer successfully bypased by the TryCatchFinally block.
Additionally, when I run this first build of my application on another machine, and click this button, I do get a security exception logged in the eventviewer, as Im supposed to, however, the TryCatchFinally mechanism is working fine and bypassing the application crash.
Am I missing something in my exception handling of the error?
Continue reading...
On one particular PC, when executing the following code on ButtonClick:
Adds registry key DoNotAllowIE10 with 0x00000001 dword entry to zone2_1 in registry which blocks Internet Explorer 10 from deploying on local machine
############################ WRITE CODE #############################################################
Dim zone2_1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0" #
My.Computer.Registry.SetValue(zone2_1, "DoNotAllowIE10", "0x00000001") #
#######################################################################################################
Its generating the following exception in the windows event logs:
Faulting application name: *** IE8.0CT build 1.3 Alpha.exe, version: 1.3.0.0, time stamp: 0x51e94f19 * where *** is company name
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18015, time stamp: 0x50b83c8a
Exception code: 0xe0434352
Fault offset: 0x0000c41f
Faulting process id: 0xd08
Faulting application start time: 0x01ce848dbdd0b6e4
Faulting application path: C:\*****************\Data\build 1.3\bin\Release\**** IE8.0CT build 1.3 Alpha.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: 1b040a7b-f081-11e2-862b-00219b399594
and this is the .NET runtime error generated in the eventviwer as well:
And the following .NET exception:
Application: **** IE8.0CT build 1.3 Alpha.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Security.SecurityException
Stack:
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])
at ****_IE80CT.My.MyApplication.Main(System.String[])
Now I have unhandled exceptions taken care of through the following in my ApplicationEvents.vb:
Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
My.Application.Log.WriteException(e.Exception,
TraceEventType.Critical,
"Application resumed functions at " &
My.Computer.Clock.LocalTime.ToString)
e.ExitApplication = False
End Sub
And the event viewer switch enabled in app.config obviously.
Heres the button actions encapsulated in a CatchTryFinally block of code:
###################################
APPLY UPDATE BLOCKER BUTTON START #
###################################
IE 10 BLOCK BUTTON, blocks Internet Explorer 10 from deploying on local machine
Private Sub blockIE10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles blockIE10.Click
AddHandler calling IE10Blocker, shows timed loading form prior to execution of code
#############################################################
Dim applyblocker As New IE10Blocker #
AddHandler applyblocker.FormClosed, AddressOf LoadingDone2 #
applyblocker.StartPosition = FormStartPosition.CenterScreen # CODE REVISION NEEDED!!!
applyblocker.Show() #
Me.Enabled = False #
#############################################################
CONTINUING, CODE THAT MODIFIES FILES ON USER-MACHINE SHALL BE MARKED AS WRITE CODE
################################## EXCEPTIONS HANDLED (2) #######################################################
Exceptions handled in Try Statement:
System.AccessViolationException
Try
Adds registry key DoNotAllowIE10 with 0x00000001 dword entry to zone2_1 in registry which blocks Internet Explorer 10 from deploying on local machine
############################ WRITE CODE #############################################################
Dim zone2_1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0" #
My.Computer.Registry.SetValue(zone2_1, "DoNotAllowIE10", "0x00000001") #
#######################################################################################################
Attempts to catch any System.AccessViolationException
Catch ex As System.AccessViolationException
Catch ex As System.Security.SecurityException
Finally allows continuation of code after exception is logged in windows event log, application will not exit, user will be prompted of failure
Finally
Logic that shows True or False based on registry key/entry existence
If My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Setup\10.0") Is Nothing Then
success2 = False
End If
End Try
End Sub
shows success or failed prompt for apply update blocker button
Private Sub LoadingDone2(ByVal sender As Object, ByVal e As System.EventArgs)
If success2 = True Then
blocker_applied.Show()
Else
blocker_failed.Show()
End If
Me.Enabled = True
End Sub
#################################
APPLY UPDATE BLOCKER BUTTON END #
#################################
In my opinion, I should have the unhandled exception throwing in the eventviewer successfully bypased by the TryCatchFinally block.
Additionally, when I run this first build of my application on another machine, and click this button, I do get a security exception logged in the eventviewer, as Im supposed to, however, the TryCatchFinally mechanism is working fine and bypassing the application crash.
Am I missing something in my exception handling of the error?
Continue reading...