.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to cast object error

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
2778 Views, 4 Replies

Unable to cast object error

I am currently going though this example here:

 

http://through-the-interface.typepad.com/through_the_interface/2010/05/populating-a-tree-view-inside...

 

but i am translating it to VB.net

 

I am reciving an error:

when this section is here is run...

   Dim mySS As AcSmSheetSet = mySSDB.GetSheetSet
   Dim mySheetsRoot As TreeNode = New TreeNode(mySS.GetName)
   tvSheetView.Nodes.Add(mySheetsRoot)

            '' Use the sheet enumerator to process the contents
            Try
                ProcessEnumerator(mySS.GetSheetEnumerator, True, mySheetsRoot) ''<< this calls the sub
            Catch ex As Exception

 when this sub is run:

Private Sub ProcessEnumerator(ByVal iter As IAcSmEnumComponent, ByVal useEnum As Boolean, ByVal root As TreeNode)
        ''Throw New NotImplementedException
        Dim item As IAcSmEnumComponent = iter.Next ''<<<< ERROR HERE
        While item IsNot Nothing
            ProcessItem(item, useEnum, root)
            item = iter.Next
        End While
    End Sub

 

 

 

Application does not support just-in-time (JIT)
debugging. See the end of this message for details.

************** Exception Text **************
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'ACSMCOMPONENTS18Lib.IAcSmEnumComponent'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{198DE879-57B6-4814-B4DA-C8E93CE5C9D8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at SSMExplorer.SSMExplorerDlg.ProcessEnumerator(IAcSmEnumComponent iter, Boolean useEnum, TreeNode root) in c:\users\adam kalajzich\documents\visual studio 2010\Projects\SSMExplorer\SSMExplorer\SSMExplorerDlg.vb:line 402
   at SSMExplorer.SSMExplorerDlg.OpenSheetSet(String myFile) in c:\users\adam kalajzich\documents\visual studio 2010\Projects\SSMExplorer\SSMExplorer\SSMExplorerDlg.vb:line 75
   at SSMExplorer.SSMExplorerDlg.btnOpenSheetSet_Click(Object sender, EventArgs e) in c:\users\adam kalajzich\documents\visual studio 2010\Projects\SSMExplorer\SSMExplorer\SSMExplorerDlg.vb:line 42
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.454 (RTMLDR.030319-4500)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
AdApplicationFrame
    Assembly Version: 0.0.0.0
    Win32 Version: 3.2.23.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AdApplicationFrame.DLL
----------------------------------------
Acdbmgd
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcdbMgd.DLL
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.447 built by: RTMLDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
msvcm90
    Assembly Version: 9.0.30729.4926
    Win32 Version: 9.00.30729.4926
    CodeBase: file:///C:/Windows/WinSxS/amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_08e1a05ba83fe554/msvcm90.dll
----------------------------------------
AdWindows
    Assembly Version: 3.2.23.0
    Win32 Version: 3.2.23.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AdWindows.DLL
----------------------------------------
PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.395
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    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.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
PresentationFramework.Aero
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Acmgd
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/Acmgd.DLL
----------------------------------------
AcWindows
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcWindows.DLL
----------------------------------------
AcCui
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcCui.DLL
----------------------------------------
AcWindows.resources
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/en-US/AcWindows.resources.DLL
----------------------------------------
AcMapResourceManagement
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMapResourceManagement.DLL
----------------------------------------
ManagedMC3
    Assembly Version: 5.8.0.0
    Win32 Version: 5.8.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/ManagedMC3.DLL
----------------------------------------
ResourceManagerRdfImp
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/ResourceManagerRdfImp.DLL
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
AcMapInfoCenter
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMapInfoCenter.DLL
----------------------------------------
AcMapLoader
    Assembly Version: 15.0.53.0
    Win32 Version: 
    CodeBase: file:///c:/program%20files/autodesk/autocad%20map%203d%202012/acmaploader.arx
----------------------------------------
ConvertText
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/ConvertText.DLL
----------------------------------------
MapPublishImp
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/MapPublishImp.DLL
----------------------------------------
OSGeo.MapGuide.PlatformBase
    Assembly Version: 2.3.0.5080
    Win32 Version: 1.0.0.1
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/OSGeo.MapGuide.PlatformBase.DLL
----------------------------------------
OSGeo.MapGuide.Foundation
    Assembly Version: 2.3.0.5080
    Win32 Version: 1.0.0.1
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/OSGeo.MapGuide.Foundation.DLL
----------------------------------------
Autodesk.Map.Platform.Core
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/Autodesk.Map.Platform.Core.DLL
----------------------------------------
Autodesk.MapGuide.Studio.Site
    Assembly Version: 2.3.0.5080
    Win32 Version: 2.3.0.5080
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/Autodesk.MapGuide.Studio.Site.DLL
----------------------------------------
AcWorkspaceSelector
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/AcWorkspaceSelector.DLL
----------------------------------------
Topobase.FeatureSearch
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.FeatureSearch.DLL
----------------------------------------
Topobase.Genuine
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Genuine.DLL
----------------------------------------
Topobase.Forms
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Forms.DLL
----------------------------------------
Topobase.Map
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Map.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.454 built by: RTMLDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
Topobase.PlugInHandler
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.PlugInHandler.DLL
----------------------------------------
Topobase.ImageResources
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.ImageResources.DLL
----------------------------------------
Topobase.Map.GWS.TBExporter.UI
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Map.GWS.TBExporter.UI.DLL
----------------------------------------
Topobase.Map.Loader
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Map.Loader.DLL
----------------------------------------
log4net
    Assembly Version: 1.2.10.0
    Win32 Version: 1.2.10.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/log4net.DLL
----------------------------------------
Topobase.Config
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Config.DLL
----------------------------------------
Topobase.Logging
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Logging.DLL
----------------------------------------
Topobase.ExceptionDialog
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.ExceptionDialog.DLL
----------------------------------------
Topobase.Services
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Services.DLL
----------------------------------------
Topobase.Collections
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Collections.DLL
----------------------------------------
Topobase.FeatureServiceListener
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.FeatureServiceListener.DLL
----------------------------------------
Topobase.Tools
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Tools.DLL
----------------------------------------
Topobase.Exception
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Exception.DLL
----------------------------------------
OSGeo.MapGuide.Geometry
    Assembly Version: 2.3.0.5080
    Win32 Version: 1.0.0.1
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/OSGeo.MapGuide.Geometry.DLL
----------------------------------------
Topobase.GwsInterface
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.GwsInterface.DLL
----------------------------------------
ManagedMapApi
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/ManagedMapApi.DLL
----------------------------------------
Topobase.Loader
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Loader.DLL
----------------------------------------
Topobase.Data
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Data.DLL
----------------------------------------
Topobase.Graphic
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Graphic.DLL
----------------------------------------
Topobase.CoordinateSystem.API
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.CoordinateSystem.API.DLL
----------------------------------------
Topobase.CIP.Waypoints
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.CIP.Waypoints.DLL
----------------------------------------
Topobase.CoordinateSystem.Factory
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.CoordinateSystem.Factory.DLL
----------------------------------------
Autodesk.UUDM.AutoCADEmbedded
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Autodesk.UUDM.AutoCADEmbedded.DLL
----------------------------------------
Autodesk.UUDM.Embedded
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Autodesk.UUDM.Embedded.DLL
----------------------------------------
Topobase.RibbonItems
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.RibbonItems.DLL
----------------------------------------
ContextualTabSelectorRules
    Assembly Version: 0.0.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcWindows.dll
----------------------------------------
Topobase.Map.AutoCAD.ContextualTabHelper
    Assembly Version: 9.0.53.0
    Win32 Version: 9.00.53.00
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/bin/Topobase.Map.AutoCAD.ContextualTabHelper.DLL
----------------------------------------
AcMapRibbon
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMapRibbon.DLL
----------------------------------------
AcMapRibbonWrapper
    Assembly Version: 15.0.53.0
    Win32 Version: 15.0.053.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMapRibbonWrapper.DLL
----------------------------------------
WindowsFormsIntegration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
AcXrefUtil
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcXrefUtil.DLL
----------------------------------------
AcLayer
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcLayer.DLL
----------------------------------------
AcLayer.resources
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/en-US/AcLayer.resources.DLL
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
AcMr
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMr.DLL
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
PresentationFramework.Luna
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Luna/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Luna.dll
----------------------------------------
AcMrUi
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcMrUI.DLL
----------------------------------------
AcMrUi.resources
    Assembly Version: 18.2.0.0
    Win32 Version: 18.2.51.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/en-US/AcMrUi.resources.DLL
----------------------------------------
Autodesk.Gis.ObjectModels.LayerDefinition-2.3.0
    Assembly Version: 2.3.0.5080
    Win32 Version: 2.3.0.5080
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/Autodesk.Gis.ObjectModels.LayerDefinition-2.3.0.DLL
----------------------------------------
AcButterflyExt
    Assembly Version: 1.0.0.23
    Win32 Version: 1.0.0.23
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/AcButterflyExt.DLL
----------------------------------------
AcButterflyExt.resources
    Assembly Version: 1.0.0.23
    Win32 Version: 1.0.0.23
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%20Map%203D%202012/en-US/AcButterflyExt.resources.DLL
----------------------------------------
SSMExplorer
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Adam%20Kalajzich/Documents/Visual%20Studio%202010/Projects/SSMExplorer/SSMExplorer/bin/Debug/SSMExplorer.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
TreeViewMS
    Assembly Version: 1.0.3765.21393
    Win32 Version: 1.0.3765.21393
    CodeBase: file:///C:/Users/Adam%20Kalajzich/Documents/Visual%20Studio%202010/Projects/SSMExplorer/SSMExplorer/bin/Debug/TreeViewMS.DLL
----------------------------------------
Microsoft.VisualStudio.Debugger.Runtime
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Debugger.Runtime/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Debugger.Runtime.dll
----------------------------------------

************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.


 

Have I got bad / invalid or confused references.

 

I have attached my references

 

Thanks for any help or pointers you may have. If you need clarification, please do not hesitate to ask.

4 REPLIES 4
Message 2 of 5
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

when you get an error with the info "InvalidCastException" I would check, what object-type do I get. So set a WatchPoint onto this line:

Dim item As IAcSmEnumComponent = iter.Next ''<<<< ERROR HERE

And when the code stops at this line, check what object-type is behind "iter.next", My guess is: the returned object from "iter,next" is not a "IAcSmEnumComponent"-type.

Be carefull while watching an iterator-object directly at the ".Next" statement, because every tim you "watch", the iterator moves to the next iteration-item.

So better would be (for debugging):

Dim testObj as Object = CObj(iter.Next)
Dim item As IAcSmEnumComponent = Nothing
if item.Gettype.Equals(Gettype(IAcSmEnumComponent)) then
   'ok, now you are on the way
   item = ctype(tTestItem, IAcSmEnumComponent)
else
   'here you see, that there is something wrong
endif

 Within this code, you have checked, if it is the objecttype you where expecting ... or not

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 3 of 5
Jeff_M
in reply to: Anonymous

HI, first of all, you don't have to include all of the loaded assemblies when posting your error...that's a lot of junk to scroll through.

 

Next, you didn't quite translate the c# code correctly, more specifically this line is wrong:

        Dim item As IAcSmEnumComponent = iter.Next ''<<<< ERROR HERE

 This is the original c# line:

IAcSmComponent item = iter.Next();

Note that there is no Enum in the c# cast.....


Jeff_M, also a frequent Swamper
EESignature
Message 4 of 5
Anonymous
in reply to: Jeff_M

sorry guys for wasting your time...

 

i can only blame myself, lack of sleep, lots of deadlines, sick family and the number 23145.

 

Message 5 of 5
Jeff_M
in reply to: Anonymous

No worries, we've all been there at some point. Most often a second, or third, set of eyes will catch the error of our ways in seconds...after we've stared at it for hours.

Jeff_M, also a frequent Swamper
EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report