-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
These are some of the most common places to receive null from the Roslyn type system, but they're annotated as non-nullable, so it's easy to forget to check for null. See
roslyn/src/Compilers/Core/Portable/Symbols/ISymbol.cs
Lines 66 to 97 in 0b2c30d
| #nullable disable // Skipped for now https://github.com/dotnet/roslyn/issues/39166 | |
| #pragma warning disable RS0041 // uses oblivious reference types | |
| /// <summary> | |
| /// Gets the <see cref="ISymbol"/> for the immediately containing symbol. | |
| /// </summary> | |
| ISymbol ContainingSymbol { get; } | |
| /// <summary> | |
| /// Gets the <see cref="IAssemblySymbol"/> for the containing assembly. Returns null if the | |
| /// symbol is shared across multiple assemblies. | |
| /// </summary> | |
| IAssemblySymbol ContainingAssembly { get; } | |
| /// <summary> | |
| /// Gets the <see cref="IModuleSymbol"/> for the containing module. Returns null if the | |
| /// symbol is shared across multiple modules. | |
| /// </summary> | |
| IModuleSymbol ContainingModule { get; } | |
| /// <summary> | |
| /// Gets the <see cref="INamedTypeSymbol"/> for the containing type. Returns null if the | |
| /// symbol is not contained within a type. | |
| /// </summary> | |
| INamedTypeSymbol ContainingType { get; } | |
| /// <summary> | |
| /// Gets the <see cref="INamespaceSymbol"/> for the nearest enclosing namespace. Returns null if the | |
| /// symbol isn't contained in a namespace. | |
| /// </summary> | |
| INamespaceSymbol ContainingNamespace { get; } | |
| #nullable enable | |
| #pragma warning restore RS0041 // uses oblivious reference types |
-
ContainingSymbol -
ContainingAssembly -
ContainingModule -
ContainingType -
ContainingNamespace
jtschusterCopilot
Metadata
Metadata
Labels
Type
Projects
Status
No status