Obtaining Fusion Version issues

// Expert user has replied.
j jamie crawford 3 years 4 months ago
1 6 0

Hi, I have had an issue where sometimes I cannot obtain the fusion version.  I think I've narrowed it down to where I can run it once after a warm boot without issue, and if I use task manager or whatever to close the application, the next time I launch and click the button I get "UNKNOWN".   After the first time I run the application successfully, I close the app and then get the error: Exception Invalid usage of Disposed Object at WLANOptions.a() at WLANConfig.b() at WLANConfig.Finalize() I have tried using config.dispose(), version=nothing, or nothing at all and get this error.   Any help is appreciated. thanks. ********************************************************************************** Imports Symbol.Fusion.WLAN Imports Symbol.Fusion Public Class class_fusionversion     Public Shared Function fusion_Version() As String         ' Get         Try             Dim Config As New Symbol.Fusion.Config             Dim Version As Symbol.Fusion.Version = Config.Version             Return Version.Fusion             Version = Nothing         Catch ex As Exception             Return "UNKNOWN"         End Try         'End Get     End Function End Class ******************************************************************** Imports System.Runtime.InteropServices Imports System.Text Imports System Imports System.IO Public Class Form1 Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' set the minimizebox to false so user will select OK and close program from memory MinimizeBox = False End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim DevInfo As class_fusionversion DevInfo = New class_fusionversion TextBox2.Text = class_fusionversion.fusion_Version End Sub End Class ***********************************************************************************

Please Register or Login to post a reply

6 Replies

j jamie crawford

Hi, I have played around for about a week without any luck trying to implement getting the fusion version number by using a class.  If I don't use a separate class like the fusion example, I can get it to work.  What is odd is that I can retrieve the mac address using the EXACT same method, and it works without throwing an exception. Most likely the problem is that my knowledge of vb is not that great and I'm just chasing my tail.  I do have some further debugging output though..  I don't know where I am getting WLANConfig.WLANOptions from.. Any help is greatly appreciated. "Invalid usage of Disposed Object" Locals $exception  {Invalid usage of Disposed Object"}  System.Exception this {Symbol.Fusion.Config.WLANConfig.WLANOptions} Symbol.Fusion.Config.WLANConfig.WLANOptions Console Project *************************************************************** Imports System Imports System.Collections Imports System.Data Imports Symbol.Fusion Imports Symbol.Exceptions Imports System.Runtime.InteropServices Public Class classfusionversion     Private myConfig As Config = Nothing     Public Sub New()         'create a reference to Config         myConfig = New Config(FusionAccessType.STATISTICS_MODE)     End Sub     Public ReadOnly Property Fusionversion()         Get             Try                 Dim version As Symbol.Fusion.Version = myConfig.Version                 Return version.Fusion                 myConfig.Dispose()             Catch ex As Exception                 Return "UNKNOWN"             End Try         End Get     End Property     Public Sub dispose()         myConfig.Dispose()     End Sub End Class ************************************************************************************ 'the two imports below are for writing to file Imports System Imports System.IO Module Module1     Sub Main()         Dim DevInfo = New classfusionversion         DevInfo = New classfusionversion         Dim path As String = "\temp\motoinfo.txt"         Dim sw As StreamWriter         ' This text is added only once to the file.         If File.Exists(path) = False Then             ' Create a file to write to.             sw = File.CreateText(path)             sw.WriteLine("Motorola Info")             sw.Flush()             sw.Close()         End If         '' This text is always added, making the file longer over time         '' if it is not deleted.         sw = File.AppendText(path)         sw.WriteLine("FUSION VERSION:" & DevInfo.Fusionversion)         sw.Flush()         sw.Close()         ' Open the file to read from.         Dim sr As StreamReader = File.OpenText(path)         Dim s As String         Do While sr.Peek() >= 0             s = sr.ReadLine()             Console.WriteLine(s)         Loop         sr.Close()     End Sub End Module

D David Williamson

jamiec, I haven't taken the time to load your sample on a device (too many other possible variables) but I did see the following when reading your sample code.  Notes are in the code with "

j jamie crawford

Hi,

After over a week of pulling my hair out, and with help from everyone, I finally got it working .  I want to thank everyone for their time helping out a newb programer as myself.

The resolution was actually pretty simple.  My "return version.fusion" was returning immediately (Thanks David) so the next line to dispose wasn't being called.  I resolved the issue by setting "version.fusion" to a variable and then disposing of myconfig and then returning the variable.  Working code below.

Imports Symbol.Fusion

Public Class class_fusionversion

    Private myConfig As Config = Nothing

    Public ReadOnly Property Fusionversion()

        Get

            Try

                myConfig = New Config(FusionAccessType.STATISTICS_MODE)

                Dim version As Symbol.Fusion.Version = myConfig.Version

                Dim output As String

                output = version.Fusion

                myConfig.Dispose()

                Return output 

            Catch ex As Exception

                Return "UNKNOWN"

            End Try

        End Get

    End Property

End Class

j jamie crawford

Hi, If I warm boot the device (mc55 wm6.5) and run the sample app, I have no issues.  I can open and close it, no problems.  As soon as I run my application, and then close it(get my error) and then launch the sample app, I get the msg box that "command mode is in use".  This shows me that my app is not disposing of the connection to command mode properly.   Thanks for pointing me in the right direction.. j

P Prashanth Kadur

Looks like your application is either crashing or not closing/disposing the Fusion object completely.  Please note that only one application can be opened in the Commmand mode at any given time. And also, open Fusion in the Command mode only if necessary.  In the EMDK sample, we first open in Command, create the new sample profiles and close the command mode.  We will then re-open the sample in the session mode for all other operations. - Prashanth Kadur

P Prashanth Kadur

Could you run the Fusion sample distributed with EMDK and check if you encounter similar issues?

CONTACT
Can’t find what you’re looking for?