This project has moved and is read-only. For the latest updates, please go here.

Error when Application.Exit is called

Aug 28, 2016 at 5:38 AM
Edited Aug 28, 2016 at 5:39 AM
Receiving the attached error when Application.Exit is called after the update has downloaded. Line 64 of DownloadUpdateDialog.cs.

Image
Aug 28, 2016 at 7:25 AM
I am unable to produce the error in my WinForms application. from where you are calling AutoUpdater start method?
Aug 28, 2016 at 8:39 AM
I'm just calling from my VB.Net app.

This is the code...

Private Sub CheckForupdatesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CheckForupdatesToolStripMenuItem.Click
    AutoUpdater.Start(strUpdatePath)
End Sub
Aug 28, 2016 at 8:41 AM
These are the details of the error...

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: Action being performed on this control is being called from the wrong thread. Marshal to the correct thread using Control.Invoke or Control.BeginInvoke to perform this action.
at System.Windows.Forms.TreeNode.Realize(Boolean insertFirst)
at System.Windows.Forms.TreeNodeCollection.AddInternal(TreeNode node, Int32 delta)
at System.Windows.Forms.TreeNodeCollection.Add(TreeNode node)
at System.Windows.Forms.TreeNodeCollection.Add(String key, String text)
at osCommerce_Store_Manager.frmMain.MDIMain_FormClosing(Object sender, CancelEventArgs e)
at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
at System.Windows.Forms.Form.RaiseFormClosingOnAppExit()
at System.Windows.Forms.Application.ExitInternal()
at System.Windows.Forms.Application.Exit(CancelEventArgs e)
at System.Windows.Forms.Application.Exit()
at AutoUpdaterDotNET.DownloadUpdateDialog.OnDownloadComplete(Object sender, AsyncCompletedEventArgs e)
at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e)
at System.Net.WebClient.DownloadFileOperationCompleted(Object arg)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1080.0 built by: NETFXREL3STAGE

CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

osCommerce Store Manager
Assembly Version: 2.5.0.11
Win32 Version: 2.5.0.11

CodeBase: file:///C:/Program%20Files%20(x86)/osCommerce%20Store%20Manager/osCommerce%20Store%20Manager.exe

Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 14.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1078.0 built by: NETFXREL3STAGE

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1064.2 built by: NETFXREL3STAGE

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1082.0 built by: NETFXREL3STAGE

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll

MySql.Data
Assembly Version: 6.7.4.0
Win32 Version: 6.7.4.0

CodeBase: file:///C:/Program%20Files%20(x86)/osCommerce%20Store%20Manager/MySql.Data.DLL

System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1080.0 built by: NETFXREL3STAGE

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll

System.EnterpriseServices
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll

System.Management
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2

CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll

AutoUpdater.NET
Assembly Version: 1.3.2.0
Win32 Version: 1.3.2.0

CodeBase: file:///C:/Program%20Files%20(x86)/osCommerce%20Store%20Manager/AutoUpdater.NET.DLL

Microsoft.mshtml
Assembly Version: 7.0.3300.0
Win32 Version: 7.0.3300.0

CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Aug 29, 2016 at 11:29 AM
Did you manage to find what's causing the problem?
Aug 29, 2016 at 12:01 PM
does MDIMain_FormClosing event method contains any code? If it does can you post what it is in there?
Aug 29, 2016 at 12:14 PM
Private Sub MDIMain_FormClosing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.FormClosing
    If bolConfirmOnExit Then
        Dim intExit As MsgBoxResult = MsgBox("Are you sure you want to exit?", CType(36, MsgBoxStyle), "Confirm exit")
        If intExit = MsgBoxResult.No Then
            e.Cancel = True
        End If
    End If
    Try
    Catch ex As Exception
        'Do nothing because nothing has been initialised
    End Try
    oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\" & kstrRegSubKeyName, True)
    tvCategories.Nodes.Add("0", oReg.GetValue("StoreName").ToString)
    oReg.SetValue("Col00X", Me.SplitContainer1.Panel1.Width)
    oReg.SetValue("Col0X", lvProducts.Columns.Item(0).Width)
    oReg.SetValue("Col1X", lvProducts.Columns.Item(1).Width)
    oReg.SetValue("Col2X", lvProducts.Columns.Item(2).Width)
    oReg.SetValue("Col3X", lvProducts.Columns.Item(3).Width)
    oReg.SetValue("Col4X", lvProducts.Columns.Item(4).Width)
    oReg.SetValue("Col5X", lvProducts.Columns.Item(5).Width)
    oReg.SetValue("Col6X", lvProducts.Columns.Item(6).Width)
    oReg.SetValue("Col7X", lvProducts.Columns.Item(7).Width)
    oReg.SetValue("Col8X", lvProducts.Columns.Item(8).Width)
    oReg.SetValue("Col9X", lvProducts.Columns.Item(9).Width)
    oReg.SetValue("Col10X", lvProducts.Columns.Item(10).Width)
    oReg.Close()
    Dispose()
End Sub
Aug 29, 2016 at 12:20 PM
I just deleted the MDIMain_FormClosing Sub & the error has gone, but it doesn't update the program.
Aug 29, 2016 at 12:43 PM
Edited Aug 29, 2016 at 12:47 PM
Does it executes the installer after the update finishes downloading? AutoUpdater.NET job finished when it executes the installer and kill all instances of your application.
Aug 29, 2016 at 12:49 PM
No it doesn't. It closed the application & then nothing happens.
Aug 29, 2016 at 12:52 PM
Can you post the XML file you are using?
Aug 29, 2016 at 12:58 PM
<?xml version="1.0" encoding="utf-8"?>
<item>
<title>A new version is available for osCommerce Store Manager</title>
<version>2.6.0.1</version>
<url>http://downloads.mgaservices.com.au/oscommerce%20store%20manager/oscommerce%20store%20manager.exe</url>
<!-- <changelog>http://downloads.mgaservices.com.au/oscommerce%20store%20manager/releasenotes.html</changelog>--> </item>
Aug 29, 2016 at 1:09 PM
You should use URL of the installer instead of only executable. If you like to update only executable you need to change the source code of AutoUpdater.NET like in the following discussion.

https://autoupdaterdotnet.codeplex.com/discussions/448314
Aug 29, 2016 at 1:11 PM
Awesome! Thanks heaps for your help! :)