Skip to content

Fix some nullable reference type issues #365

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

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abstract class AssemblyFinder
{
public abstract IReadOnlyList<AssemblyName> FindAssembliesContainingName(string nameToFind);

protected static bool IsCaseInsensitiveMatch(string text, string textToFind)
protected static bool IsCaseInsensitiveMatch(string? text, string textToFind)
{
return text != null && text.ToLowerInvariant().Contains(textToFind.ToLowerInvariant());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static bool HasImplicitValueWhenNotSpecified(ParameterInfo paramInfo)
|| paramInfo.ParameterType == typeof(IConfiguration);
}

object GetImplicitValueForNotSpecifiedKey(ParameterInfo parameter, MethodInfo methodToInvoke)
object? GetImplicitValueForNotSpecifiedKey(ParameterInfo parameter, MethodInfo methodToInvoke)
{
if (!HasImplicitValueWhenNotSpecified(parameter))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public StringArgumentValue(string providedValue)
return type;
}

internal static bool TryParseStaticMemberAccessor(string input, [NotNullWhen(true)] out string? accessorTypeName, [NotNullWhen(true)] out string? memberName)
internal static bool TryParseStaticMemberAccessor(string? input, [NotNullWhen(true)] out string? accessorTypeName, [NotNullWhen(true)] out string? memberName)
{
if (input == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void ShouldBindToConstructorArguments(string caseSection, Type targetType
var testSection = _config.GetSection(caseSection);

Assert.True(ObjectArgumentValue.TryBuildCtorExpression(testSection, targetType, new(), out var ctorExpression));
Assert.Equal(expectedExpression, ctorExpression?.ToString());
Assert.Equal(expectedExpression, ctorExpression.ToString());
}

class A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void StringValuesConvertToDefaultInstancesIfTargetIsAbstractClass()
// a full-qualified type name should not be considered a static member accessor
[InlineData("My.NameSpace.Class, MyAssembly, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
null, null)]
public void TryParseStaticMemberAccessorReturnsExpectedResults(string input, string expectedAccessorType, string expectedPropertyName)
public void TryParseStaticMemberAccessorReturnsExpectedResults(string input, string? expectedAccessorType, string expectedPropertyName)
{
var actual = StringArgumentValue.TryParseStaticMemberAccessor(input,
out var actualAccessorType,
Expand Down