Skip to content

Provide winrt_activation_handler to hook/mock activation#477

Merged
kennykerr merged 3 commits intomasterfrom
kennykerr-handler
Jan 16, 2020
Merged

Provide winrt_activation_handler to hook/mock activation#477
kennykerr merged 3 commits intomasterfrom
kennykerr-handler

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jan 16, 2020

Fixes #476

This is required by the Windows shell team.

@kennykerr kennykerr requested a review from jlaanstra January 16, 2020 21:36
Comment on lines +24 to +28
if (winrt_activation_handler)
{
return winrt_activation_handler(*(void**)(&name), guid_of<Interface>(), result);
}

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
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