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.
Summary
Core.OnCreateProxyShareEventArgsdoes not store the constructor'sisEnumeratorargument. It assigns the property to itself, so custom proxy-share handlers always observe the default value.Background
COMProxySharehas a special enumerator path.Core.CreateNewProxyShare()raises theCreateProxyShareevent with anisEnumeratorflag so custom handlers can create an appropriate proxy share.Current constructor:
Relevant code path:
Source/NetOffice/CoreExtensions/Core.Nested.cs:OnCreateProxyShareEventArgsUse Case
A consumer or test harness can subscribe to
Core.CreateProxyShareto 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:
Add a small unit test that raises
CreateProxySharefor an enumerator path and asserts the event argument value is true.