1

Closed

NullReferenceException while editing code

description

Using pytools 1.5 on vs2012 I suddenly got a message box telling me to check AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml, there I found two exceptions:
  <entry>
    <record>307</record>
    <time>2013/03/28 09:39:57.540</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.PythonTools.Analysis.Values.ModuleInfo.get_Description()
   at Microsoft.PythonTools.Intellisense.QuickInfoSource.AugmentQuickInfoWorker(ExpressionAnalysis vars, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan)
   at Microsoft.PythonTools.Intellisense.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.DefaultQuickInfoController.OnTextView_MouseHover(Object sender, MouseHoverEventArgs e)
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()</description>
  </entry>
  <entry>
    <record>308</record>
    <time>2013/03/28 09:39:57.542</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.PythonTools.Analysis.Values.ModuleInfo.get_Description()
   at Microsoft.PythonTools.Intellisense.QuickInfoSource.AugmentQuickInfoWorker(ExpressionAnalysis vars, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan)
   at Microsoft.PythonTools.Intellisense.QuickInfoSource.AugmentQuickInfoSession(IQuickInfoSession session, IList`1 quickInfoContent, ITrackingSpan& applicableToSpan)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoBroker.TriggerQuickInfo(ITextView textView, ITrackingPoint triggerPoint, Boolean trackMouse)
   at Microsoft.PythonTools.Intellisense.IntellisenseController.TextViewMouseHover(Object sender, MouseHoverEventArgs e)
   at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()</description>
  </entry>
Closed Sep 13, 2013 at 5:50 PM by huguesv

comments

Zooba wrote Mar 28, 2013 at 4:29 PM

Are you able to share the code that causes this? It looks like it happened when you moved the mouse over a module name. This is only likely to occur if we've parsed the module incorrectly (maybe it's empty?), so I'd like to figure out why it's happened. Unfortunately, the stack trace on its own doesn't help much.

noam0101 wrote Mar 28, 2013 at 5:13 PM

I've managed to recreate it consistently with this code:
from apps.app1 import defs as app1_defs
import defs

def foo():
    x = [i for i in [] if i == defs.SOME_DEF]
When I hover on defs in the list comprehension, I get the message box. This code resides in a django app (not app1). Both apps have a defs.py file.

Zooba wrote Mar 28, 2013 at 8:44 PM

Thanks. I'll have a go at reproducing the issue.

I doubt there'll be any fix for the current version of PTVS, but we should be able to prevent it from occurring in 2.0.

Zooba wrote Apr 25, 2013 at 4:19 PM

Fixed in 2.0 feature branch.