ProvideCorrectArgumentsToFormattingMethodsAnalyzer throws IndexOutOfRangeException when building Microsoft.Extensions.Logging.Abstractions
ericstj opened this issue · 5 comments
Description
When building Microsoft.Extensions.Logging.Abstractions I see the diagnostic
error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.Runtime.ProvideCorrectArgumentsToFormattingMethodsAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'
I'll suppress this when enabling AD0001 as warning. This issue will track fixing that analyzer and removing the warning suppression
Reproduction Steps
Remove AD0001 from Microsoft.Extensions.Logging.Abstractions.csproj and build it.
Expected behavior
Builds without warning.
Actual behavior
Warning as above
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.
Issue Details
Description
When building Microsoft.Extensions.Logging.Abstractions I see the diagnostic
error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.Runtime.ProvideCorrectArgumentsToFormattingMethodsAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'
I'll suppress this when enabling AD0001 as warning. This issue will track fixing that analyzer and removing the warning suppression
Reproduction Steps
Remove AD0001 from Microsoft.Extensions.Logging.Abstractions.csproj and build it.
Expected behavior
Builds without warning.
Actual behavior
Warning as above
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Author: | ericstj |
---|---|
Assignees: | - |
Labels: |
|
Milestone: | - |
I have investigated this and found this is issue in the analyzer that not handling the case when using a method with StringSyntaxAttribute parameter and not having any other parameters. CompositeFormat.Parse is an example of that. And The actual line throwing IndexOutOfRangeException is https://github.com/dotnet/roslyn-analyzers/blob/7e4877c40535652d7d44a238ea48b03f47f63e29/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/ProvideCorrectArgumentsToFormattingMethods.cs#L428C18-L428C18.
We already have a PR dotnet/roslyn-analyzers#6885 for fixing the analyzer.
@buyaa-n as we talked offline, you are going to follow up with the analyzer PR and then flow the fix to the runtime repo with removing the warning suppression in the project. Please ensure porting the fixes to 8.0 release branch. Thanks!
Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.
Issue Details
Description
When building Microsoft.Extensions.Logging.Abstractions I see the diagnostic
error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.Runtime.ProvideCorrectArgumentsToFormattingMethodsAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'
I'll suppress this when enabling AD0001 as warning. This issue will track fixing that analyzer and removing the warning suppression
Reproduction Steps
Remove AD0001 from Microsoft.Extensions.Logging.Abstractions.csproj and build it.
Expected behavior
Builds without warning.
Actual behavior
Warning as above
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Author: | ericstj |
---|---|
Assignees: | tarekgh |
Labels: |
|
Milestone: | 8.0.0 |