Skip to content

OnCreateProxyShareEventArgs loses isEnumerator value #482

@jozefizso

Description

@jozefizso

Summary

Core.OnCreateProxyShareEventArgs does not store the constructor's isEnumerator argument. It assigns the property to itself, so custom proxy-share handlers always observe the default value.

Background

COMProxyShare has a special enumerator path. Core.CreateNewProxyShare() raises the CreateProxyShare event with an isEnumerator flag so custom handlers can create an appropriate proxy share.

Current constructor:

internal OnCreateProxyShareEventArgs(ICOMObject requestedFrom, bool isEnumerator)
{
    RequestedFrom = requestedFrom;
    IsEnumerator = IsEnumerator;
}

Relevant code path:

  • Source/NetOffice/CoreExtensions/Core.Nested.cs: OnCreateProxyShareEventArgs

Use Case

A consumer or test harness can subscribe to Core.CreateProxyShare to customize proxy-share behavior, logging, ownership, or release policy. That handler needs to know whether the proxy is an enumerator so it can preserve NetOffice's enumerator handling.

Problem

The event argument drops the real flag. Custom handlers cannot distinguish enumerator proxies and may create a normal COMProxyShare, bypassing the special release behavior intended for enumerators.

Suggested Fix

Change the assignment to:

IsEnumerator = isEnumerator;

Add a small unit test that raises CreateProxyShare for an enumerator path and asserts the event argument value is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions