-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NRE at Microsoft.CodeAnalysis.SymbolKey.NonDeclarationSymbolKey`1.<EnumerateSymbols> #11092
Comments
I am hitting this frequently even with the latest InstallDogfood bits from master - I am marking this as urgency soon and rolling back to older Roslyn bits :-( |
FYI @dpoeschl |
Note that all the crashes seem to occur when there are errors in code being edited. I rolled back to Roslyn bits from 27th April and still hitting this crash. Rename tracking diagnostic is marked as NotConfigurable, so I guess it cannot be suppressed either. |
I rolled back to bits from the 26th April and haven't seen any more crashes. Probably something checked in during these 2 days that regressed this? |
Commented too soon - got the same exception on bits from 26th as well :-( |
@mavasani ran into this just now.
Looks to be the same issue. I'll take a look. |
I have a consistent repro now:
|
Can we also consider making Rename tracking diagnostic configurable, so that it can be disabled if the user doesn't care about this feature? |
So here's whats happening: public static SymbolKey GetSymbolKey(this ISymbol symbol)
{
return SymbolKey.Create(symbol, null, CancellationToken.None);
} We call internal static SymbolKey Create(ISymbol symbol, CancellationToken cancellationToken = default(CancellationToken))
{
return GetOrCreate(symbol, new Visitor(compilation, cancellationToken));
} We create a new visitor object with a null compilation. Normally this would be the end of it but we crash due to this null compilation later. private static SymbolKey GetOrCreate(ISymbol symbol, Visitor visitor)
{
if (symbol == null)
{
return s_null;
}
SymbolKey result;
if (!visitor.SymbolCache.TryGetValue(symbol, out result))
{
>> result = symbol.Accept(visitor);
visitor.SymbolCache[symbol] = result;
}
return result;
} The call to Accept will cause the visitor to be exercised. We jump through the visit methods until we arrive at public override SymbolKey VisitLocal(ILocalSymbol localSymbol)
{
>> return new NonDeclarationSymbolKey<ILocalSymbol>(localSymbol, this);
} Which calls Enumerate Symbols internal NonDeclarationSymbolKey(TSymbol symbol, Visitor visitor)
{
var containingSymbol = symbol.ContainingSymbol;
while (!containingSymbol.DeclaringSyntaxReferences.Any())
{
containingSymbol = containingSymbol.ContainingSymbol;
}
_containingKey = GetOrCreate(containingSymbol, visitor);
_localName = symbol.Name;
>> foreach (var possibleSymbol in EnumerateSymbols(visitor.Compilation, containingSymbol, _localName, visitor.CancellationToken))
{
if (possibleSymbol.Item1.Equals(symbol))
{
_ordinal = possibleSymbol.Item2;
break;
}
}
} In this case because of the visitation pattern we end up calling |
@jmarolf I have consistent repro for this now, and I verified that this time the exception is NRE from
|
I do not have a repro, but am hitting this NRE very often while typing. It seems to be from RenameTrackingTaggerProvider.
I have InstallDogfood bits from master which are a day old (1.03.0.60503)
Dump saved at:
\\<%Internal_Share%>\public\dumps\11092\devenv.dmp
Message:
Object reference not set to an instance of an object.
Call stack:
The text was updated successfully, but these errors were encountered: