-
Notifications
You must be signed in to change notification settings - Fork 291
Open
Description
Describe the bug
The codefix ignores the case of string.StartsWith(char)
Steps To Reproduce
[TestMethod]
public void TestMethod2()
{
string myText = "abc";
Assert.IsTrue(myText.StartsWith('a'));
}Expected behavior
a)
[TestMethod]
public void TestMethod2()
{
string myText = "abc";
Assert.StartsWith("a", myText);
}or b)
overloads akin to StartsWith(char substring, string? value, ..., which would also solve the problem with chars in variables
Actual behavior
[TestMethod]
public void TestMethod2()
{
string myText = "abc";
Assert.StartsWith('a', myText);
// ^^^--- Error CS1503 Argument 1: cannot convert from 'char' to 'string?'
}Additional context
prior analyzers complained about a string with a single char inside the .Contains(..) method