Author Topic: Basic Button Crash (Version 3.9.9.24)  (Read 2192 times)

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Basic Button Crash (Version 3.9.9.24)
« on: May 16, 2020, 11:35:16 PM »
Hi Dears I an making a process demo and everything goes fine until my application began to crash in random way the following piece of code appear with the error, I am using vertion 3.9.9.24:

Private Sub ReleaseValue()
        Try
            Select Case m_OutputType
                Case MfgControl.AdvancedHMI.Controls.OutputType.MomentarySet : m_ComComponent.Write(m_PLCAddressClick, 0)
                Case MfgControl.AdvancedHMI.Controls.OutputType.MomentaryReset : m_ComComponent.Write(m_PLCAddressClick, 1)
            End Select
        Catch ex As MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException

            If ex.ErrorCode = 1808 Then
                DisplayError("""" & m_PLCAddressClick & """ PLC Address not found")
            Else
                DisplayError(ex.Message)
            End If
        End Try
    End Sub

When the error appear the IDE higligth the follow word m_ComComponent in the basic button file lines 469 and 470.

Would you help me to fix it ?

Thanks in advance !!


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #1 on: May 17, 2020, 02:45:58 AM »
You don't say what the error is. My guess is that you have the Exception setting set to stop on all Common Language Runtime Exceptions and you have a PLC communication issue.

Does this occur if you are not running inside the IDE?

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #2 on: May 17, 2020, 07:14:25 AM »
Hi Archy thank for answer, I have read a lot of post from you I think you are making a wonderful work.

Archi I will post the error number the next time that it appears, I just have tested the application inside the IDE, one of my question is why the Cath sentence I not working? At the begining I believed that the error was different of the error number in the if sentence so I commented the it and wrote an unconditional Message Box("communication error") but I got the same unmanaged exception.



BVR
« Last Edit: May 17, 2020, 08:03:59 AM by Bvillalobos »

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #3 on: May 17, 2020, 07:18:29 AM »
By the way I. My application I have one Mainform with one EtherntIPCLXCom drive and several popup forms with the basic buttons and their own EthenetIPCLXCom drives pointing in some cases the same address.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #4 on: May 17, 2020, 08:49:10 AM »
Go to Debug->Windows->Exception Setings (or Ctrl+Alt=E)
In the Exception Settings windows, right click Common Language Runtime Exceptions and select Restore Defaults

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #5 on: May 17, 2020, 12:59:26 PM »
Thanks for you answer Archi, I reset the exception strings but jus now I got the same error:

Sistem.ObjectDisposedException: Safe handle has been closed




Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #6 on: May 17, 2020, 01:04:48 PM »
Following the error log form Visual Studio 2012:

'AdvancedHMI.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMI\bin\Debug\AdvancedHMI.exe'. Symbols loaded.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMI\bin\Debug\MfgControl.AdvancedHMI.Drivers.dll'. Module was built without symbols.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMI\bin\Debug\AdvancedHMIControls.dll'. Symbols loaded.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMI\bin\Debug\AdvancedHMIDrivers.dll'. Symbols loaded.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMI\bin\Debug\MfgControl.AdvancedHMI.Controls.dll'. Module was built without symbols.
'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'.
The thread 0x2acc has exited with code 0 (0x0).
The thread 0x46c has exited with code 0 (0x0).
The thread 0xbe0 has exited with code 0 (0x0).
The thread 0x2fc has exited with code 0 (0x0).
The thread 0x3324 has exited with code 0 (0x0).
The thread 0x34cc has exited with code 0 (0x0).
The thread 0x38f0 has exited with code 0 (0x0).
The thread 0x2c0c has exited with code 0 (0x0).
The thread 0xe4c has exited with code 0 (0x0).
The thread 0x2d18 has exited with code 0 (0x0).
The thread 0x1430 has exited with code 0 (0x0).
The thread 0x3538 has exited with code 0 (0x0).
The thread 0x2060 has exited with code 0 (0x0).
The thread 0xd1c has exited with code 0 (0x0).
The thread 0x3bcc has exited with code 0 (0x0).
The thread 0x1a70 has exited with code 0 (0x0).
The thread 0x370c has exited with code 0 (0x0).
The thread 0x3748 has exited with code 0 (0x0).
The thread 0x1534 has exited with code 0 (0x0).
The thread 0x5dc has exited with code 0 (0x0).
The thread 0x3304 has exited with code 0 (0x0).
Exception thrown: 'System.ObjectDisposedException' in mscorlib.dll
An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
Safe handle has been closed

'AdvancedHMI.exe' (CLR v4.0.30319: AdvancedHMI.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x3d74 has exited with code 0 (0x0).

Unhandled Exception: System.ObjectDisposedException: Safe handle has been closed
   at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
   at System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
   at System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext)
   at System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout)
   at MfgControl.AdvancedHMI.Drivers.EthernetIPforCLX.Write(String startAddress, Int32 numberOfElements, String[] dataToWrite)
   at MfgControl.AdvancedHMI.Drivers.EthernetIPforCLX.Write(String startAddress, String dataToWrite)
   at AdvancedHMIControls.BasicButton.ReleaseValue() in C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMIControls\Controls\BasicButton.vb:line 469
   at AdvancedHMIControls.BasicButton.MaxHoldTimer_Tick(Object sender, EventArgs e) in C:\Users\BVILLALOBOS\Documents\Advance HMI\AdvancedHMIControls\Controls\BasicButton.vb:line 493
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at MfgControl.AdvancedHMI.My.MyApplication.Main(String[] Args) in :line 81
The program '[2320] AdvancedHMI.exe' has exited with code 0 (0x0).



Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #7 on: May 17, 2020, 01:24:10 PM »
Are you hiding or closing the popup forms? It looks like something is getting disposed some where and I will guess the popups are being closed which will dispose of the driver. Does your BasicButton also close the form?

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #8 on: May 17, 2020, 02:01:08 PM »
Yes when  I the radnomized eception appear afther close the popup window, I normally close this windows with one Visual Basic button or with the standart windows close icon.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #9 on: May 17, 2020, 02:19:09 PM »
Can you do a hide instead of close? Or maybe set the MinimumHoldTime to 0

What I suspect is happening is the button writes a 1 to the PLC, next the form is closed, then after the MinimumHoldTime, the driver tries to write a 0 to the PLC, but it has already started the dispose process.

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #10 on: May 17, 2020, 03:14:04 PM »
Ok Archie I will do it, by te way I just tested with the bin file out of VB Studio and change the type of button to Momentary Button with the same result :-\

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #11 on: May 17, 2020, 05:09:36 PM »
Hi Archie I hided All the popup windows and it look like the problem disappear !, thanks, nice support we are planing to use AHMI in industrial projects, we are going to evaluate you Hardware to do that.

Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #12 on: May 17, 2020, 08:35:48 PM »
Yes!! The exception goes !!! Thank

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #13 on: May 17, 2020, 09:43:17 PM »
If the exception still goes then you should consider redesigning your project and abandon the way you are doing things right now.


Bvillalobos

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Basic Button Crash (Version 3.9.9.24)
« Reply #14 on: May 18, 2020, 08:48:38 PM »
Thanks Godra for your advising but until I change Me.close () by Me.Hide() in the Popup windows everythings it Ok !!