Skip to content

NullReferenceException leads to disabling of IntelliSense components #75

@galvn

Description

@galvn

Description

The IntelliSenseExtender extension throws a System.NullReferenceException when committing an IntelliSense completion. This error, originating from within the extension, causes a subsequent failure in Visual Studio's internal IntelliSense mechanism, leading to the AggregateTypeCompletionProvider being disabled and a related warning being shown.

Steps to Reproduce

  1. Install the IntelliSenseExtender extension.
  2. Write some C# code where IntelliSense completion is triggered.
  3. Select an item from the IntelliSense suggestions.
  4. Commit the completion (e.g., by pressing Enter or Tab).
  5. An error dialog will appear in the Visual Studio UI, and the stack trace for the exception will be logged.

Expected Behavior

The extension should handle IntelliSense completions without throwing exceptions or causing other built-in components to be disabled.

Actual Behavior

After committing a completion, two related error notifications appear:

  1. UI Warning: 'AggregateTypeCompletionProvider' has encountered an error and has been disabled.
  2. Stack Trace Error:

Error Message

System.NullReferenceException: Object reference not set to an instance of an object.
   at async IntelliSenseExtender.ExposedInternals.LanguageServicesExtensions.GetPlacementOptionsAsync(<Unknown Parameter>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async IntelliSenseExtender.ExposedInternals.LanguageServicesExtensions.AddImportsAsync(<Unknown Parameter>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async IntelliSenseExtender.Editor.NamespaceResolver.AddNamespaceImportAsync(<Unknown Parameter>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async IntelliSenseExtender.IntelliSense.CompletionCommitHelper.GetChangeAsync(<Unknown Parameter>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameter>)

Environment Information

  • Visual Studio Version: 17.14.16
  • IntelliSenseExtender Version: 1.9.2
  • Operating System: Windows 11

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions