Merge pull request #13384 from tamasvajk/fix/standalone-explicit-interface-error

C#: Improve error message for missing explicit interface implementation
This commit is contained in:
Tamás Vajk
2023-06-07 12:19:08 +02:00
committed by GitHub

View File

@@ -243,7 +243,12 @@ namespace Semmle.Extraction.CSharp.Entities
if (methodKind == MethodKind.ExplicitInterfaceImplementation)
{
// Retrieve the original method kind
methodKind = methodDecl.ExplicitInterfaceImplementations.Select(m => m.MethodKind).FirstOrDefault();
if (methodDecl.ExplicitInterfaceImplementations.IsEmpty)
{
throw new InternalError(methodDecl, "Couldn't get the original method kind for an explicit interface implementation");
}
methodKind = methodDecl.ExplicitInterfaceImplementations.Select(m => m.MethodKind).First();
}
switch (methodKind)