'Exception in parser'


I am using VS2017, Resharper Ultimate C++, version 2018.1 built 04/14/2018. Visual Studio is version 15.7.27703.

There are some cpp files within the solution that are failing to be parsed. In the UI all that I can see is a red squiggle under the first character in this file, and if I hover over it the message "Exception in parser". The first line in this file is "#include "<a file>"", and the red squiggle is under the hashtag. There are other cpp files in the same solution, located in the same directory, with the same #include at the top, that don't have this issue.

I have been trying to find out some more verbose information but there doesn't seem to be any more information available. Re-running an inspection just yields the same terse error.

I have tried (restarted Visual Studio after every attempt):

  • Clearing the cache.
  • Unloading the project / reloading the project.
  • Copy and pasting the file into a new file.
  • Suspending resharper and then un-suspending.
  • Toggling analysis off/on/off/on for the single file.
  • Make sure in the options that the "Resharper Intellisense" is used.
  • Disabling "Read project properties" in "ReSharper | Options | Code Editing | C++ | Performance".
    This one was promising because after I did this, syntax coloring at least worked. But navigation still did not work.
  • Checking that the project is not excluded in resharper options.
  • Turning full solution analysis on/off/on/off.
  • Enable inspections, quick fixes, context actions in files external to the solution.

Thank you for your time.

Comment actions Permalink


Would you be able to share this solution with us so we could investigate? If not, please restart Visual Studio with the /ReSharper.Internal command-line argument. You should see a red icon with an exclamation sign in the lower right corner next time the exception is thrown. Please open the exception browser by clicking the sign and submit the exceptions to us. 


Comment actions Permalink

Thank you very much Igor, I have submitted the exception and tagged this thread in the submission.

The text of the exception was "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index". It is in an external library header file. I looked through the file and checked for code that was accessing arrays/vectors, and tried commenting out bits and pieces of the code that contained accesses, but it did not solve the issue.

Comment actions Permalink

Thanks! The issue is https://youtrack.jetbrains.com/issue/RSCPP-22399.

We've seen this before - it is a bug in our preprocessor implementation, but we haven't been able to reproduce this. It seems to occur during deep nested macro substitutions. We would really appreciate if you could share with us the code where this exception occurs, JetBrains can sign a non-disclosure agreement if needed.

Thanks again!

Comment actions Permalink

Igor, we only have the .h file and not the implementation since it is an external library, would that help figure out the problem? 

Also, I cannot view the issue you linked due to access permissions, thanks.

Comment actions Permalink

Sorry, I've updated the visibility of the issue.

The problem also could be in one of the other headers that the .h file in question includes. If at all possible, the best way would be to create a repro solution with the necessary header files where this exception manifests.


Please sign in to leave a comment.