/// <summary> /// Tries to resolve the provided <paramref name="symbolKey"/> in the given /// <paramref name="compilation"/> to a matching symbol. <paramref name="resolveLocations"/> /// should only be given <see langword="true"/> if the symbol was produced from a compilation /// that has the exact same source as the compilation we're resolving against. Otherwise /// the locations resolved may not actually be correct in the final compilation. /// </summary> public static SymbolKeyResolution Resolve( string symbolKey, Compilation compilation, bool ignoreAssemblyKey = false, bool resolveLocations = false, CancellationToken cancellationToken = default) { using (var reader = SymbolKeyReader.GetReader( symbolKey, compilation, ignoreAssemblyKey, resolveLocations, cancellationToken)) { var result = reader.ReadFirstSymbolKey(); Debug.Assert(reader.Position == symbolKey.Length); return(result); } }