Which PSI elements are IDeclaredElement.IsSynthetic() ?

I observed that IsSynthetic() returns true for ASP.NET WebForms' Render-method, or Razor's Write-methods. Are there more? What is the definition of an "synthetic" PSI element?

1 comment
Comment actions Permalink

This indicates that the declared element is defined in a "secondary" PSI file, and doesn't originate in user code. For example, aspx files have a hidden, secondary C# file generated that represents the C# that gets generated when the aspx file is compiled. This allows ReSharper to provide code completion for methods that are defined in this generated C# class. Any methods that are in this class and not part of the user code that appears in an aspx file are marked as synthetic. Internally, we're considering this API as somewhat out of date. Seconday PSI generation has changed greatly since this was introduced, and the number of synthetic entities has been greatly reduced. The method will likely be removed at some point, and the handling of synthetic elements handled in the building of symbol tables, instead.


Please sign in to leave a comment.