DimensionStyle with ID 00000000-0000-0000-0000-000000000000

"An exception of type ‘Rhino.Runtime.DocumentCollectedException’ occurred in RhinoCommon.dll but was not handled in user code

Additional information: Could not find DimensionStyle with ID 00000000-0000-0000-0000-000000000000

If there is a handler for this exception, the program may be safely continued."

This exception is happening in RhinoCommon.dll when requesting the doc.DimStyles.Current.Name while trying to open a saved document. Should I be testing for something before requesting the current Dimension Style name in this scenario?

Best;

Steve

Hi @slyon,

Can you provide a code sample that repeats this?

Thanks,

– Dale

@dale
Dale:

Yes but you probably don’t want a full copy of the plug-in so i will need to skinny it down to focus on the problem area. I should have it to you by tomorrow. And again, this is one of those warning exceptions that seam to be taken care at runtime when not using VS to debug. My assumption is that you guys would still like to know about them.

A complicating factor is the use of panels. Where it is failing is when I use the current dimension style name in a drop down as the default. If there is some sort of validation strategy that I should run or if there is a way to close down then bring back up the panel using the RhinoDocOnCloseDocument event just let me know.

I think I will pass along the rhino file that I am trying to open to give you a full example. This may or may not be a contributing factor. I am using User Data that I don’t think has any impact but what the heck, these are complicated structures.

Best;

Steve

No full projects, please. The smaller the better. Code to a test command works best.

– Dale

Dale @dale

I would not do it to you. Save that stuff for my enemies;)

Anyway, sorry for the delay. Got caught up in Visual Studio error that lasted a day.

This is what is happening from my newbie point of view. When opening a new document from an open Rhino instance a RhinoDocOnDimensionStyleTableEvent DimStyleTableEventType.Added event is fired. The only thing I am doing is:

  • Opening Rhino in VB 2019 debug mode
  • Code is filling the Drop-down Controls
  • Setting the default to _doc.DimStyles.Current.Name
  • File=>Open=>Save Changes=>No=>Select the new document

Witch must be triggering the event on close. When it does the following error occurs:

Rhino.Runtime.DocumentCollectedException
  HResult=0x80131500
  Message=Could not find DimensionStyle with ID 00000000-0000-0000-0000-000000000000
  Source=RhinoCommon
  StackTrace:
   at Rhino.DocObjects.DimensionStyle._InternalGetConstPointer()
   at Rhino.Runtime.CommonObject.ConstPointer()
   at Rhino.DocObjects.ModelComponent.get_Name()
   at CSProjectTemplateController.BuildPanelController.DrpDimensionStyleHeaderSetup() in D:\Temp\New folder (42)\CSProjectTemplate\CSProjectTemplate\BuildPanelController.cs:line 67
   at CSProjectTemplateController.BuildPanelController.RhinoDocOnDimensionStyleTableEvent(Object sender, DimStyleTableEventArgs args) in D:\Temp\New folder (42)\CSProjectTemplate\CSProjectTemplate\BuildPanelController.cs:line 35
   at Rhino.RhinoDoc.OnDimStyleTableEvent(UInt32 docSerialNumber, Int32 eventType, Int32 index, IntPtr pConstOldSettings)

Command defined to open the Panels is "CSProjectTemplateCommand: (class CSProjectTemplateCommand : Command) if the panels do not open.

I have taken out as much code that I can but this is failing on code behind of a panel so I wanted to leave that so you have a full picture of the environment but I have striped out anything that does not get you to the error.

Put a break point on BuildPanelController.cs->RhinoDocOnDimensionStyleTableEvent and it will take you to the code that is failing when you select another document. At the point of the error there still is an active document.

Let me know if you have any questions:

Best;

Steve

CSProjectTemplate.zip (625.3 KB)