Message 1 of 4
Structured BOM Error, caused by phantom component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i try to read the filename value from a structured BOM. Visual Studio returns an error when i get to the lines where the parts are, which are members of a phantom component.
Dim oBOM As BOM
oBOM = oAssembly.ComponentDefinition.BOM
' Make sure it's enabled
oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = False
Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("structured")
Dim oBOMRows As BOMRowsEnumerator
oBOMRows = oBOMView.BOMRows
Dim oBOMRow As BOMRow
For Each oBOMRow In oBOMRows
Try
myFileName = oBOMRow.ReferencedFileDescriptor.FullFileName
Catch ex As Exception
'a member of a phantom-component!
MsgBox("Error on Pos.: " & oBOMRow.ItemNumber)
End Try
Next
Error getting on Visual Studio 2012, german:
System.Runtime.InteropServices.COMException wurde nicht behandelt.
ErrorCode=-2147467259
HResult=-2147467259
Message=Unbekannter Fehler (Ausnahme von HRESULT: 0x80004005 (E_FAIL))
Source=""
StackTrace:
bei System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
bei Inventor.BOMRow.get_ReferencedFileDescriptor()
bei TBF.Form1.getFilenameAndItemFromParent(AssemblyDocument oMyParentAssembly, AssemblyDocument oMyAssembly) in C:\Users\Username\Desktop\lesson1_VisualExpress2010_Complete\Form1.vb:Zeile 312.
bei TBF.Form1.setPosNr() in C:\Users\Username\Desktop\lesson1_VisualExpress2010_Complete\Form1.vb:Zeile 252.
bei TBF.Form1.ButtonStart_Click(Object sender, EventArgs e) in C:\Users\Username\Desktop\lesson1_VisualExpress2010_Complete\Form1.vb:Zeile 225.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei TBF.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 82.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException: