DotNetAnalyzers / AspNetCoreAnalyzers

MIT License
62 stars 4 forks source link

AD0001 Analyzer 'AspNetCoreAnalyzers.AttributeAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' #70

Closed Ekkeir closed 4 years ago

Ekkeir commented 4 years ago

The problem

The warning below is emitted when building my project where route is defined on class. CSC : warning AD0001: Analyzer 'AspNetCoreAnalyzers.AttributeAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'.

To Reproduce

Create new empty ASP Net Core Web Application Add the following class

using Microsoft.AspNetCore.Mvc;

namespace AnalyzerBugRepro
{
    [ApiController]
    [Route("api/")]
    public class GrantStubController : ControllerBase
    {
    }
}

Build the project Observe the error in build output.

JohanLarsson commented 4 years ago

Thanks for reporting, this is a perfect issue! Never worry about creating issues, no issue is worse than duplicate issue or poor issue.

JohanLarsson commented 4 years ago

https://www.nuget.org/packages/AspNetCoreAnalyzers/0.2.0.1-dev

Sorry about the bug and the slow fix.

Ekkeir commented 4 years ago

As long as it's fixed, thanks a lot!

sungam3r commented 4 years ago

I think 0.2.0.1-dev is not semver compatible version, 0.2.0-dev1 would be better.

JohanLarsson commented 4 years ago

I think 0.2.0.1-dev is not semver compatible version, 0.2.0-dev1 would be better.

@sungam3r does it break nuget.exe so the package should be republished with correct version? I can republish and unlist if so, only takes seconds.

sungam3r commented 4 years ago

I have installed the package from VS 2019. Maybe some other clients might have problems, I don't know.