I'm creating na analyzer for Visual Studio, and I need the Solution property required by SymbolFinder.FindSourceDefinitionAsync(ISymbol, Solution) to ensure that I'm really operating over the type I want.
public static async Task<ITypeSymbol> GetBaseScenario(ITypeSymbol type)
{
if (type == null)
return null;
var origType = await SymbolFinder.FindSourceDefinitionAsync(type, _solution);
if (BaseScnSymbols.Contains(origType) || BaseVersionScnSymbols.Contains(origType))
return origType as ITypeSymbol;
return null;
}
I can get the Semantic Model, the compilation, but I can't get the solution. How can I get the solution? Is there a better approach for this problem?