NullReferenceException on ParameterInfoSession.Open() if item collection is empty

SyntaxEditor for WPF Forum

Posted 5 years ago by Dirk Zellerfeld
Version: 19.1.0681
Platform: .NET 3.0 (Core)
Environment: Windows 10 (64-bit)

Calling ParameterInfoSession.Open throws a nullreference exception if the item collection is empty. The source code of the sample application is not clear about that. For example in ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.GettingStarted11 and also in ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.GettingStarted09 it does not check if Items.Count > 0 like it does in ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.GettingStarted10

While it kinda makes sense to not call the open method if the item collection is empty, I would suggest adding this check on your end in the open method. Because even though it make no sense, it's still not expected to throw rather than immediately returning from the call. What are your thoughts?

Code to reproduce

private static ParameterInfoSession Session = new ParameterInfoSession();
public override bool RequestSession(IEditorView view, bool canCommitWithoutPopup)
System.NullReferenceException: 'Object reference not set to an instance of an object.'

at ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt.Implementation.ParameterInfoSession.OnClosed(CancelEventArgs e)
at ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt.Implementation.IntelliPromptSessionBase.Close(Boolean cancelled)
at ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt.Implementation.IntelliPromptSessionBase.Open(IEditorView view, TextRange textRange)

Comments (1)

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Dirk,

Thanks for letting us know about this.  We've fixed the problem on our side for the next maintenance release.

Actipro Software Support

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.