Skip to content

Commit

Permalink
MA0124 supports array types
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou committed Oct 24, 2023
1 parent f8c7264 commit 3297c75
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ LoggerConfigurationFile LoadConfiguration()
{
foreach (var symbol in symbols)
{
if (symbol.Kind == SymbolKind.NamedType)
if (symbol.Kind is SymbolKind.NamedType or SymbolKind.ArrayType)
{
types.Add(symbol);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ await CreateProjectBuilder()
.WithSourceCode(SourceCode)
.AddAdditionalFile("LoggerParameterTypes.txt", """
Prop;System.Guid;System.Nullable{System.Guid}
""")
.ValidateAsync();
}

[Fact]
public async Task Logger_LogTrace_ValidParameterType_StringArray()
{
const string SourceCode = """
using Microsoft.Extensions.Logging;

ILogger logger = null;
logger.LogInformation("{Prop}", new string[1]);
""";
await CreateProjectBuilder()
.WithSourceCode(SourceCode)
.AddAdditionalFile("LoggerParameterTypes.txt", """
Prop;System.String[]
""")
.ValidateAsync();
}
Expand Down

0 comments on commit 3297c75

Please sign in to comment.