Export to GitHub

dxcorecommunityplugins - issue #159

CR_ExtensionMethodsHelper causing NullReferenceException


Posted on Jun 17, 2014 by Happy Lion

Which edition of the DevExpress toolset are you using?

* CodeRush (pro)

Which version of the DevExpress toolset are you using?

  • 14.1

Which version of Studio are you using?

  • VS2013

What OS?

  • Win 8.1 x64

Which community plugin(s) are you attempting to use? CR_ExtensionMethodsHelper

What steps will reproduce the problem? 1. Open attached solution (a solution containing a project that references a project in the same solution) 2. In SomeMethod there is a l.Count() extension method call 3. Just place your caret on the "Count". This will case an NullReferenceException in the log and the "Add Namespace Reference" is not displayed as an option.

What is the expected output? What do you see instead? The extension should display "Add Namespace Reference" for an extension method for which there is no namespace import.

Attachments

Comment #1

Posted on Jun 17, 2014 by Happy Lion

The exception thrown is:

Type: System.NullReferenceException Message: Object reference not set to an instance of an object. Source: CR_ExtensionMethodsHelper Target: System.Collections.IEnumerable GetProjectSymbols()

Call Stack: at CR_ExtensionMethodsHelper.PlugIn1.GetProjectSymbols() at CR_ExtensionMethodsHelper.PlugIn1.cpAddReference_CheckAvailability(Object sender, CheckContentAvailabilityEventArgs ea) at DevExpress.CodeRush.Core.ContentProvider.OnCheckAvailability(CheckContentAvailabilityEventArgs ea)

Comment #2

Posted on Jun 17, 2014 by Happy Lion

I have managed to debug this issue and come up with a fix.

In method CR_ExtensionMethodsHelper.PlugIn1.GetProjectSymbols() there is an if-statement as follow:

if (reference == null) continue;

It should be:

if (reference == null || reference.AssemblyModel == null) continue;

Comment #3

Posted on Jun 17, 2014 by Helpful Bear

This should now be fixed.

Please download v1.1 from this plugin's new home on github @

https://github.com/RoryBecker/CR_ExtensionMethodsHelper/releases/latest

Note: I suggest removing your existing plugin dll before attempting to use this new version, which does not install in the same location.

Status: Fixed

Labels:
Type-Defect Priority-Medium