-
Notifications
You must be signed in to change notification settings - Fork 23
SA0001 : CoreParser : An exception occurred while parsing the file #49
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
Comments
Hi, any updates/fixes for the above issue? Happens to me too. Currently working in a huge project and we tried upgrading from StyleCop.MsBuild to Visual-StyleCop.MSBuild 4.7.58.3 hoping to get support for new features in C#6, and now StyleCop crashes as seen below: filename.cs(1,1): error : SA0001 : CoreParser : An exception occurred while parsing the file: System.FormatException, Index (zero based) must be greater than or equal to zero and less than the size of the argument list. |
I managed to workaround the crash mentioned above, so, I will provide here the source of the issues maybe someone will have time to fix them: #1 "string []" has to be replaced with "string[]" (no space allowed between "string" and "[]". I didn't checked if happens for other types also or only for string arrays. #2 I had to replace this: with this: t => (above code is same, only that is formatted on multiline; issue was reported as syntax error for some reason instead of formatting issue. #3 Had to be replaced with (explicit paranthesys): x = (reader["syspart"] as int?) ?? 0; That's about all for our project. Thanks in advance for those who will fix these :) ! |
There is an error on line 415 of StyleCopThread.cs:
This prevents the original exception from being shown to the user, so it's unclear how to diagnose the underlying StyleCop error. |
In my case it was caused by a variable named '_' (in a using (...) statement) |
Hi,
When I replaced v4.7.49 with Visual-StyleCop.MSBuild 4.7.58.3 from https://www.nuget.org/packages/Visual-StyleCop.MSBuild
I started to have following exception on some specific file:
...cs(1,1): error : SA0001 : CoreParser : An exception occurred while parsing the file: System.FormatException, Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
.cs(1,1): error : at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
.cs(1,1): error : at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
.cs(1,1): error : at System.String.Format(IFormatProvider provider, String format, Object[] args)
.cs(1,1): error : at StyleCop.StyleCopThread.RunAnalyzers(CodeDocument document, SourceParser parser, IEnumerable
1 analyzers) .cs(1,1): error : at StyleCop.StyleCopThread.TestAndRunAnalyzers(CodeDocument document, SourceParser parser, IEnumerable
1 analyzers, Int32 passNumber).cs(1,1): error : at StyleCop.StyleCopThread.ParseAndAnalyzeDocument(SourceCode sourceCode, DocumentAnalysisStatus documentStatus)
.cs(1,1): error : at StyleCop.StyleCopThread.DoWork(Object sender).
Same with Visual-StyleCop... 4.7.54
The text was updated successfully, but these errors were encountered: