Skip to content
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

Adjust reflection based optimization for SyntaxTreeCategorizedAnalyzerConfigOptions #5780

Open
mavasani opened this issue Jan 5, 2022 · 2 comments
Assignees
Labels
Milestone

Comments

@mavasani
Copy link
Contributor

mavasani commented Jan 5, 2022

See

static ImmutableDictionary<string, string>? TryGetBackingOptionsDictionary(AnalyzerConfigOptions analyzerConfigOptions)
{
// Reflection based optimization for analyzer config options.
// Ideally 'AnalyzerConfigOptions' would expose such an the API.
var type = analyzerConfigOptions.GetType();
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
return type.GetField("_backing", flags)?.GetValue(analyzerConfigOptions) as ImmutableDictionary<string, string> ??
type.GetField("_analyzerOptions", flags)?.GetValue(analyzerConfigOptions) as ImmutableDictionary<string, string>;
}

dotnet/roslyn#58579 renames the backing dictionary field

@tmat
Copy link
Member

tmat commented Jan 7, 2022

Do we need dotnet/roslyn#41840 to remove the reflection?

@mavasani
Copy link
Contributor Author

mavasani commented Jan 8, 2022

Yes, that will likely help.

@mavasani mavasani self-assigned this Oct 13, 2022
@mavasani mavasani added this to the 17.5 P1 milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants