Skip to content

Provide winrt_activation_handler to hook/mock activation - #477

Merged
Kenny Kerr (kennykerr) merged 3 commits into
masterfrom
kennykerr-handler
Jan 16, 2020
Merged

Provide winrt_activation_handler to hook/mock activation#477
Kenny Kerr (kennykerr) merged 3 commits into
masterfrom
kennykerr-handler

Conversation

@kennykerr

@kennykerr Kenny Kerr (kennykerr) commented Jan 16, 2020

Copy link
Copy Markdown
Collaborator

Fixes #476

This is required by the Windows shell team.

Comment thread strings/base_activation.h
Comment on lines +24 to +28
if (winrt_activation_handler)
{
return winrt_activation_handler(*(void**)(&name), guid_of<Interface>(), result);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires the custom activation handler to deal with all possible activation scenarios. In certain kinds of tests that might be an overkill. It would be nice to have a way for the custom handler to return a magic value signifying that it cannot handle that specific activation and the default activation procedure should just continue, something like:

        if (winrt_activation_handler)
        {
            if (auto hr = winrt_activation_handler(*(void**)(&name), guid_of<Interface>(), result);
                hr != E_NOTIMPL) {
                    return hr;
                }
        }
        ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree - I've had need for this flexibility myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need a way to mock/hook WinRT runtime class activation for testing

3 participants