I wrote code analyzer & fix provider for adding validations to ensure argument is not null. It works good for multiple methods, but I cannot check all the parameters at once. The analyzer will mark all the parameters that are not checked already, but fix can be done only for one parameter at once.
Details: It is not immutable nodes issue, the code adds using statement if needed.
In the analyzer i register diagnostic for every parameter.
Diagnostic diagnostic = Diagnostic.Create(
Rule,
parameter.GetLocation(),
null,
prop.ToImmutableDictionary(),
parameter.Identifier.Text);
In the fix provider I am taking first diagnostic from the context and register code fix for that.
Maybe I am doing something wrong and thus do not get multiple diagnostics in the fix provider.
What is the correct way to make multiple fixes? Should be the key/id of the diagnostic the same? Or should the diagnostic be registered directly to complain about all the parameters.