Crash bug when using QuickInfo

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0545
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Repro Steps:

1. Open the Actipro Sample Browser
2. Open the C# Editor (.NET Lang Add-On) sample
3. First, add a semicolon after "int ErrorTest = 1"
4. After the Console.WriteLine statement, insert a couple newlines
5. Then insert the following C#:

foreach (var bob in bobs.Where(item => item.Whatever) { } 
6. Hover over the word Whatever.

The Sample Browser crashes with a NRE.

Probable Cause:
I believe you'll find the issue is in the ResolverScopeManager's ScopeContext(ITypeMemberDefinition) constructor. You reference the containingTypeMemberDefinition's DeclaringType property without first checking if the containingTypeMemberDefinition is null.

Outside of adding a try-catch around the spot where we initiate a QuickInfo, is there any way we can avoid this exception from being thrown? I ask since we're hitting this in our own applications.



Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Craig,

Thanks, we found that a few weeks ago and the fix is in the next version's codebase already.

As for a workaround, you can't prevent that bug since as you said, we missed a null check. What you are doing now is ok.

Or if you want to get a little crazier, you could create your own quick info provider service that wraps our CSharpQuickInfoProvider and replace the default CSharpQuickInfoProvider service with yours. In a GetContext method override, create a wrapper class that implements IDotNetContext and wrap the base.GetContext call with that if the result is non-null. In your IDotNetContext implementation for the Resolve method, put your try...catch there.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.