Exception Analysis for Errors Detection in the SharpChecker Static Analyzer for C#
Mikhail Belyaev, Valery Nikolayevich Ignatyev · 2021
Exception handling is a widely used runtime error management method in object-oriented languages, especially C#, where it is deeply embedded in the standard library (CoreFX). Accurate and efficient exception analysis is an important requirement for an industrial-level static analyzer. We propose a novel approach to manage exceptions while performing static symbolic execution of C# programs, which is able to process the newest features of the language, such as catch filters. In contrast to the approaches implemented in other static analysis tools, it is much more accurate, because it is path-sensitive thanks to consideration of exception conditions, field- and object-sensitive thanks to the representation of separate exceptions and its fields with distinct symbolic values. We evaluate our approach on a large set of open source projects having 4.2 mln LOC and nearly 2000 reviewed warnings of different types.