Random Crashes - Theme Editor 1.37.2.

Posts: 62
Hey there,

This is probably user error, but recently the Theme Editor is crashing randomly, and when I export a theme and load it into ATVO to test, it will often fail to load the first time, and then load properly if I just click the Load button again.

Some other strange behaviours are that sometimes when I load my current theme into the Theme Editor, some folders might be empty, for example, the Widgets folder, or Buttons folder .. and that seems to correspond with the error message I get (the editor will crash when I edit a button for example, and then that folder goes empty, and might even be empty when I reload the .atvotheme file)

Details:

- Latest Alpha version (as of March 21, 2021)

- Modifying my own theme based on the ATVO theme created by Nick

- I've modified lots of the scripts, and copied and renamed lots of the widgets, so maybe I've created issues by doing that?

- ATVO Telemetry Recorder is running while loading/reloading theme editor and theme into ATVO (this tool is awesome! thanks for this! should i close it every time i reload a theme though?)

Log file from the most recent Theme Editor Crash:

Error: 3/21/2021 8:34:53 PM (UTC)
ATVO version: 1.37.2.0
Themes SDK version: 1.33.0.0
Theme version: none

Unhandled exception
System.NullReferenceException: Object reference not set to an instance of an object.
at ATVO.ThemeEditor.Utils.TreeViewUtils.ExpandAndContinue(TreeViewItem root, Object item, Action`1 action) in D:\Users\Nick\Documents\Programming\ATVO\Appgineer.in-TV-Overlay-for-iRacing\ATVO.ThemeEditor\Utils\TreeViewUtils.cs:line 0
at System.Windows.Controls.ItemContainerGenerator.SetStatus(GeneratorStatus value)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.StartAt(GeneratorPosition position, GeneratorDirection direction, Boolean allowStartAtRealizedItem)
at System.Windows.Controls.Panel.GenerateChildren()
at System.Windows.Controls.Panel.EnsureGenerator()
at System.Windows.Controls.Panel.get_InternalChildren()
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Thanks!
Posts: 785
The error log you posted is an annoying recurring problem that I can't seem to find the cause for. It seems random but is definitely related to loading and saving of a theme, and related to if you have elements expanded in the 'theme explorer' list. I'll have a look at it again.

You say there are also other issues with crashing, is there any error logs, different than the one you posted?
Posts: 62
I'll get the error sometimes just editing the theme. I'll start playing closer attention to what I did just before the error and report back.

And I think I can reproduce the error going back and forth between exporting the theme file and loading it up in ATVO.

I'll return with more steps and log files when I can.
Thanks for looking into it!
Posts: 62
Not sure if this adds more detail:

I don't think I've modified your "Scoring Box" button from your theme (I've changed the widget and subwidget contents, but not the button behaviour, I don't think).

I've been able to reproduce:

Open the theme
First thing i do is go to Controls, and select the Scoring Box button.

I get the ATVO - Error:

"Object reference not set to an instance of an object"

and the related log file is pasted below.

As mentioned, I've duplicated lots of widgets and subwidgets, and so there are lots of instances of the same objects with the "Copy of .." prefix to the names.

I wasn't able/willing to rename some because after much experimentation I learned that some of the scripts are hard-coded to the widget names and I was breaking too many things .. so i've left lots of names that don't really reflect what they relate to, and have multiple copies of the objects as a result.

That probably has nothing to do with it . but thought I'd mention it :)


Error: 3/23/2021 1:18:13 AM (UTC)
ATVO version: 1.37.2.0
Themes SDK version: 1.33.0.0
Theme version: none

Unhandled exception
System.NullReferenceException: Object reference not set to an instance of an object.
at ATVO.ThemeEditor.Utils.TreeViewUtils.ExpandAndContinue(TreeViewItem root, Object item, Action`1 action) in D:\Users\Nick\Documents\Programming\ATVO\Appgineer.in-TV-Overlay-for-iRacing\ATVO.ThemeEditor\Utils\TreeViewUtils.cs:line 0
at System.Windows.Controls.ItemContainerGenerator.SetStatus(GeneratorStatus value)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.StartAt(GeneratorPosition position, GeneratorDirection direction, Boolean allowStartAtRealizedItem)
at System.Windows.Controls.Panel.GenerateChildren()
at System.Windows.Controls.Panel.EnsureGenerator()
at System.Windows.Controls.Panel.get_InternalChildren()
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Posts: 62
Hi Nick,

I have a way to reproduce this error 100% of the time. I also have working hypothesis that I hope helps you get to the bottom of this.

Reproduction Steps

Version: 1.38.1.0
Theme: ATVO_Theme

1. Open the default ATVO_Theme file provided by ATVO
2. Click the Controls Tab
3. Click the X button to the right of the Grid button
- ATVO Error
Object Reference not set to an instance of an object.

My working hypothesis is that these crashes are related to copying a Control button. As I started making more copies of the X button to map to other Scenes and Animations, the crashes happened instantly I clicked the copied button in the Theme Editor.

I have seen that ATVO will attempt to recursively rename an object name in other places it is referenced (which is nice!), and so I'm hoping that this error is related to something in that logic going wrong.

Unfortunately, now that I've made many copies of Control buttons, my theme is crashing all the time, and I'm thinking I just need to start from scratch (which is ok because I'm still learning :) but I hope this is an easy one to track down and fix. Let me know if you need any other info from me.

Thanks!
Posts: 62
Trying to attach a sample Error Message

Posts: 785
Thanks Jeremy. I finally managed to reproduce consistently thanks to your results and found an issue. I can at least prevent the crash, and the functionality still seems correct after my fix, but I am still not convinced that everything is fully operational. Basically I just added a "if this scenario happens, just ignore it", but I don't know why it's happening in the first place.

I am going to release a fix right now.

Hopefully it resolves your issues and you can open your theme again!

It had nothing to do with renaming by the way, so if there are still other issues perhaps they are related...
Posts: 62
Thanks Nick!

I've just tested the updated version, and can confirm it no longer crashes :)

And here's an extra nugget that might help you target in on the culprit:

I forgot to mention that in addition to the Error message, the other thing that would happen is that the "Buttons" folder would go completely empty. I would have no choice but to close ATVO Theme Editor and reopen it again to get the Buttons folder populated now.

With this latest build, when I repeat the exact same steps I posted above, when I click that same X button, the Button folder automatically opens and the B-HideGrid button object in the Thme Explorer is automatically highlighted Blue.

So is it possible that Object Not Found bug is related to the behaviour of automatically selecting the Control in the Theme Editor?

Hope this is helpful . .and thanks again for the fix .. Looks like I won't have to start from scratch :)

-Jeremy
Posts: 785
Exactly, the crash happened in the logic where it tries to find the node in the tree that belongs to whatever you clicked, and then it walks down the tree opening each parent node until it reaches it. For some reason, sometimes this fails and then it gives me nothing in return, which was causing the crash. I am now simply preventing the crash when this happens, but I did not solve the root cause (why is it not giving me anything back?). But it seems to have no effect and work just fine so I'm not sure what else to do :) For now please monitor if you see more strange behavior.