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.
Hello George,
Thank you for your post. I have been looking into it and since this is not a known issue, I wasn’t able to reproduce your behavior, so it will be very helpful if you can create an isolated sample, where the issue is reproduced, so we could be able to investigate this further for you.
Looking forward for your reply.
Hi Stefan,
I have actually created a support request for this issue and it is currently being investigated by one of your colleagues.
Regards,
George
Hi George,
I was able to reproduce this issue thanks to the sample you provided and I have logged a development issue for it. The development ID is 144031. Your support case has already been linked to the development issue. Once the issue is resolved you will be notified automatically through the support case at which point I will also provide an update to this forum thread so that others who are experiencing the same issue will be notified.
Hi George and CyclingClyde,
This issue has been resolved in the latest service release. You can download from the My Keys & Downloads section on your account pages. https://es.infragistics.com/my-account/keys-and-downloads/
I have almost an identical setup in terms of usage in my application. I have a tabbed application where each script tab contains just the xamSyntaxEditor plus a settings tab.
The script tab has no code-behind and does not yet manipulate the xamSyntaxEditor.Document.
<Grid Name="LayoutRoot">
<ig:XamSyntaxEditor x:Name="TextEditor"
<ig:XamSyntaxEditor.Document>
<ig:TextDocument />
</ig:XamSyntaxEditor.Document>
</ig:XamSyntaxEditor>
</Grid>
If I have multiple script tabs open and close the settings tab then I get a null reference exception but it's different...
Object reference not set to an instance of an object.
at Infragistics.Controls.Editors.AdornmentGeneratorBase..ctor(DocumentViewBase documentView, AdornmentLayerInfo layerInfo)
at Infragistics.Controls.Editors.CaretAdornmentGenerator..ctor(DocumentViewBase documentView)
at Infragistics.Controls.Editors.CaretAdornmentGeneratorProvider.CreateAdornmentGenerator(DocumentViewBase documentView)
at Infragistics.Controls.Editors.DocumentViewBase.CreateAdornmentGenerators()
at Infragistics.Controls.Editors.DocumentViewBase.OnDocumentChanged(TextDocument oldDocument, TextDocument newDocument)
at Infragistics.Controls.Editors.EditorDocumentView.OnDocumentChanged(TextDocument oldDocument, TextDocument newDocument)
at Infragistics.Controls.Editors.XamSyntaxEditor.NotifyViewsOfDocumentChange(TextDocument oldDocument, TextDocument newDocument)
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)