Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Description

The fNullOk parameter on MethodTable::GetMethodDescForComInterfaceMethod was always passed as false at its single call site. Analysis confirmed the function never returns NULL in practice.

Changes

  • Removed bool fNullOk parameter from function signature and call site
  • Fixed POSTCONDITION to disallow NULL return (removed NULL_OK flag)
  • Replaced conditional NULL return path with assertion
    • The FindDynamicallyAddedInterface check now uses _ASSERTE() since it has no side effects and must always be true when reached

Before:

MethodDesc *GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD, bool fNullOk)
{
    // ...
    else if (FindDynamicallyAddedInterface(pItfMT))
        RETURN(pItfMD);
    else
        RETURN(NULL);  // Never actually reached
}

After:

MethodDesc *GetMethodDescForComInterfaceMethod(MethodDesc *pItfMD)
{
    // ...
    _ASSERTE(FindDynamicallyAddedInterface(pItfMT));
    RETURN(pItfMD);  // Always returns valid MethodDesc
}

Microsoft Reviewers

Open in CodeFlow


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 28, 2026 05:33
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove fNullOk parameter from GetMethodDescForComInterfaceMethod Remove unused fNullOk parameter from GetMethodDescForComInterfaceMethod Jan 28, 2026
Copilot AI and others added 2 commits January 28, 2026 07:00
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
Co-authored-by: AaronRobinsonMSFT <30635565+AaronRobinsonMSFT@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants