Inventor 2026 WPF APP error/bug/exception

Inventor 2026 WPF APP error/bug/exception

basautomationservices
Advocate Advocate
752 Views
4 Replies
Message 1 of 5

Inventor 2026 WPF APP error/bug/exception

basautomationservices
Advocate
Advocate

Hi all,

 

When running my add-in with inventor 2026, I get an error when I save a document. 

My addin is a dockable WPF window where you can edit iProperties. 

 

I have a feeling it could be related to a mismatch in package versions. Error is thrown from inventor DLL's.

 

Exception info below:

 

basautomationservices_0-1744621790748.png

 

 

System.Windows.Markup.XamlParseException
  HResult=0x80131501
  Message=Add value to collection of type 'Microsoft.Xaml.Behaviors.TriggerActionCollection' threw an exception.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) in System.Windows.Markup\XamlReader.cs:line 401
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri) in System.Windows.Markup\XamlReader.cs:line 396
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) in System.Windows\FrameworkTemplate.cs:line 780
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField) in System.Windows\FrameworkTemplate.cs:line 687
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren) in System.Windows\FrameworkTemplate.cs:line 517
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate) in System.Windows\StyleHelper.cs:line 920
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container) in System.Windows\FrameworkTemplate.cs:line 494
   at System.Windows.FrameworkElement.ApplyTemplate() in System.Windows\FrameworkElement.cs:line 1706
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3485
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) in System.Windows.Controls\Grid.cs:line 1454
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged) in System.Windows.Controls\Grid.cs:line 1393
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint) in System.Windows.Controls\Grid.cs:line 986
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint) in System.Windows.Controls\Grid.cs:line 1051
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) in System.Windows.Controls\Grid.cs:line 1454
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged) in System.Windows.Controls\Grid.cs:line 1393
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint) in System.Windows.Controls\Grid.cs:line 1006
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) in MS.Internal\Helper.cs:line 320
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) in System.Windows.Documents\AdornerDecorator.cs:line 72
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint) in System.Windows.Controls\Grid.cs:line 1051
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint) in System.Windows.Controls\Border.cs:line 368
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3538
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Window.MeasureOverrideHelper(Size constraint) in System.Windows\Window.cs:line 2328
   at System.Windows.Window.MeasureOverride(Size availableSize) in System.Windows\Window.cs:line 1743
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3488
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Window.SetRootVisualAndUpdateSTC() in System.Windows\Window.cs:line 2209
   at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight) in System.Windows\Window.cs:line 2194
   at System.Windows.Window.CreateSourceWindow(Boolean duringShow) in System.Windows\Window.cs:line 2053
   at System.Windows.Window.ShowHelper(Object booleanBox) in System.Windows\Window.cs:line 3427
   at System.Windows.Window.Show() in System.Windows\Window.cs:line 1450
   at System.Windows.Window.ShowDialog() in System.Windows\Window.cs:line 1549
   at Autodesk.Inventor.Dialogs.FileDialog.FileDialogTerm.StartFileDialogModal(String messageName, BinaryReader inputs, BinaryWriter replies)
   at Autodesk.Inventor.IPC.InputMessageChannel.SendMessage(Byte[] message)
   at WHxMessageChannelNative.SendMessage(WHxMessageChannelNative* , RMxBinaryBuffer* inputs, RMxBinaryBuffer* outputs)

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
ArgumentException: Cannot add instance of type 'EventCommandExecuter' to a collection of type 'TriggerActionCollection'. Only items of type 'T' are allowed.

 

Contact me for custom app development [email protected]. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro


0 Likes
753 Views
4 Replies
Replies (4)
Message 2 of 5

JelteDeJong
Mentor
Mentor

Hi Bas, I am not familiar with this exception. Why do you think it has anything to do with your WPF forms? I would investigate the Inventor save events. I noticed some new behaviour (in Inventor 2025 coming from 2023.) For example; it reacts differently when you abort an transaction in an event function.

But if you expect problems related to a mismatch in package versions, you could check if all your Microsoft/system packages have version 8.*.* I noticed that the 9.*.* versions are not always working correctly. Not sure if you are using DevExpress, but you could also check that version.

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 5

basautomationservices
Advocate
Advocate

Hi Jelte,

 

Thanks for the reply. Me neither..

 

I had a feeling the WPF forms were causing it cause of a previous error, this happened when I tried to use a datePicker from MahApps.Metro and it conflicted also in the Microsoft.Xaml.Behaviors library. 

I thought so cause when I debug that add-in and save a document it throws this exception. I came from 2025 to 2026.

Will investigate further 🙂

Contact me for custom app development [email protected]. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro


0 Likes
Message 4 of 5

basautomationservices
Advocate
Advocate

Investigated a bit further.

I found that if I remove the reference to Xaml.Behaviors completely from my project, I don't get the exception anymore. Don't know if it's just because i'm not loading that debug information anymore.

 

I added the Xaml.Behaviors DLL from the inventor directory as a reference, and the error is gone. The version on that DLL is 1.1.39.xxxx, the version i get from Nuget is 1.1.39. Don't know what exactly is the problem but for me it is fixed now.

Contact me for custom app development [email protected]. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro


0 Likes
Message 5 of 5

jjstr8
Collaborator
Collaborator

Are you (or a library you're using) using a reference to System.Windows.Interactivity from Blend?

0 Likes