kevinmiles / dxcorecommunityplugins

Automatically exported from code.google.com/p/dxcorecommunityplugins
0 stars 0 forks source link

CR_ExtensionMethodsHelper causing NullReferenceException #159

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by mot...@gmail.com on 17 Jun 2014 at 7:23

Attachments:

GoogleCodeExporter commented 8 years ago
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)

Original comment by mot...@gmail.com on 17 Jun 2014 at 7:27

GoogleCodeExporter commented 8 years ago
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;

Original comment by mot...@gmail.com on 17 Jun 2014 at 7:30

GoogleCodeExporter commented 8 years ago
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.

Original comment by RoryBec...@gmail.com on 17 Jun 2014 at 11:41