Roslyn: exception on "Find all references"

Created on 17 May 2019  路  12Comments  路  Source: dotnet/roslyn

@AArnott reported this issue.

05/17/2019 05:55:08 : Error : Microsoft.CodeAnalysis.Remote.CodeAnalysisService (37) : Exception: System.InvalidOperationException: Unexpected Null
   at Roslyn.Utilities.Contract.ThrowIfNull[T](T value, String message)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.VerifyForwardedTypes(Dictionary`2 equivalentTypesWithDifferingAssemblies, Compilation compilation, HashSet`1 verifiedKeys, Boolean isSearchSymbolCompilation)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.VerifyForwardedTypes(Dictionary`2 equivalentTypesWithDifferingAssemblies, ISymbol searchSymbol, ISymbol symbolToMatch, Solution solution, Compilation searchSymbolCompilation, Compilation symbolToMatchCompilation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.OriginalSymbolsMatchCore(ISymbol searchSymbol, ISymbol symbolToMatch, Solution solution, Compilation searchSymbolCompilation, Compilation symbolToMatchCompilation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.OriginalSymbolsMatch(ISymbol searchSymbol, ISymbol symbolToMatch, Solution solution, Compilation searchSymbolCompilation, Compilation symbolToMatchCompilation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Shared.Extensions.ITypeSymbolExtensions.<>c__DisplayClass16_0.<FindImplementationsForInterfaceMemberAsync>b__1(ISymbol m)
   at System.Linq.ImmutableArrayExtensions.FirstOrDefault[T](ImmutableArray`1 immutableArray, Func`2 predicate)
   at Microsoft.CodeAnalysis.Shared.Extensions.ITypeSymbolExtensions.<FindImplementationsForInterfaceMemberAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.<FindImplementationsAsync>d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.FindSymbols.Finders.AbstractMethodOrPropertyOrEventSymbolReferenceFinder`1.<DetermineCascadedSymbolsAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---

here is repro step from andrew

git clone https://github.com/aarnott/vs-streamjsonrpc.git
cd vs-streamjsonrpc\src 
git checkout RoslynBugRepro
streamjsonrpc.sln

Open the JsonMessageFormatter.cs file. I personally have all methods "collapsed" except WriteJToken, and I have the caret on the bufferTextWriter field reference on the first line of that method. Then I scroll down paste it a bit when the failure occurs.

Area-IDE Bug Developer Community

Most helpful comment

experiencing on 16.1.4

All 12 comments

this looks like "Find all reference" is called by code lens.

@AArnott told me this didn't happen in the previous version.

so, either "find all reference" has changed or "find all reference" seems missing cases around typeforward in new .net core or .net fx.

I'm not certain waht VerifyForwardedTypes is. It was not part of the original FindRefs. Was it added to handle some case?

@CyrusNajmabadi I dont know. probably need to see history to find out.

@jinujoseph this seems happening quite often with d16.2 preview 1 and after. so probably need to fix it soon.

alright, debugged through. @ryzngard can you take a look?

it looks like this PR - https://github.com/dotnet/roslyn/pull/33227

this particular line has issue
https://github.com/dotnet/roslyn/pull/33227/files#diff-6ac787baaecdd3bcc7e33f069d4b381cR183

basically, you can't pass in null for "symbolToMatchCompilation". you need to give destination compilation as well.

also reported here (16.1)
also reproted here
also reported here (16.2.PReview2)

Just here to add another log - recently updated to VS 16.1.3 - still occurs
roslynCodeAnalysis-17332-nwknnogt-1.log

Also still experiencing this on 16.1.3

experiencing on 16.1.4

This is still happening in VS 2019 Enterprise 16.1.5 when I select "Go to Implementation" on a method defined through an interface.

ActivityLog.zip

Still experiencing the issue with vs 2019 16.1.6 when I select "Go to Implementation" on a method defined through an interface.

ActivityLog.zip

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codingonHP picture codingonHP  路  3Comments

vbcodec picture vbcodec  路  3Comments

NikChao picture NikChao  路  3Comments

MadsTorgersen picture MadsTorgersen  路  3Comments

OndrejPetrzilka picture OndrejPetrzilka  路  3Comments