Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Null Reference Exception in Syntax Editor
posted

I have recently integrated your XamSyntaxEditor into my application to replace a Textbox that was previously used for scripting. It all appears to be working correctly except for one certain scenario that is throwing an "Object reference not set to an instance of an object" error.

Our application has multiple tabs, and the scripting tab is not in focus when the application starts. The scripting tab holds a view that contains the syntax editor control. If i launch the application, and load a different view (in this case, the application settings window) then close this view, I get an unhandled exception:

Source: InfragisticsWPF4.Controls.Editors.XamSyntaxEditor.v13.1

Message: Object reference not set to an instance of an object.

Stack Trace: at Infragistics.Controls.Editors.XamSyntaxEditor.EnsureCorrectNumberOfViewsForCurrentSplitStatus()
at Infragistics.Controls.Editors.XamSyntaxEditor.ProcessDocumentChange(DocumentChangeInfo documentChangeInfo)
at Infragistics.Controls.Editors.XamSyntaxEditor.<TriggerAsyncDocumentChangeProcessing>b__27()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

However, if i launch the application and then browse to the scripting tab that holds the Syntax Editor control, I can then browse to the application settings window and this error does not occur when I close the application settings window.

The view within the scripting tab that contains the Syntax Editor control has a view model attached to it and i can successfully hit breakpoints within it's constructor where it instantiates a new text document on the property that the syntax editor is bound to.

The xaml where i declare the syntax editor control is this:

<ig:XamSyntaxEditor Grid.Column="0" 
BorderThickness="0" Name="script" 
FontFamily="Courier New" FontSize="14" IsLineNumberMarginVisible="True"
Document ="{Binding Path=Script, Mode=TwoWay}"
AcceptsTab="True" ErrorDisplayMode="Never"
SplitStatus="NotSplit" SplitOptions="SplittingNotAllowed" />

I should be able to create a sample application that reproduces this behavior but before I spend hours doing that I was just wondering if anyone knew what the problem was here?

Thanks.

Parents Reply Children
No Data