microsoft / ConcordExtensibilitySamples

Visual Studio Debug Engine Extensibility Samples
Other
122 stars 50 forks source link

Component with WorkerProcessSupported="true" is not being loaded into remote msvsmon process #62

Closed WheretIB closed 4 years ago

WheretIB commented 4 years ago

I have decided to split some work with C++ IDiaSession into a worker component and I have created a new vsdconfigxml file with a separate C# class:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="http://schemas.microsoft.com/vstudio/vsdconfig/2008">
    <DefineGuid Name="guidLuaLocalWorkerDebuggerComponent" Value="7EA4B490-BDF9-42AD-8A5B-BCA60741E5D6"/>
    <DefineGuid Name="guidLuaMessageToLocalWorker" Value="CD3A296C-3C54-4B5E-AF46-8B72F528E4B5"/>

    <ManagedComponent ComponentId="guidLuaLocalWorkerDebuggerComponent" ComponentLevel="1999100" AssemblyName="LuaDkmDebuggerComponent">
        <Class Name="LuaDkmDebuggerComponent.LocalWorkerComponent" WorkerProcessSupported="true">
            <Implements>
                <InterfaceGroup>
                    <Filter>
                        <SourceId RequiredValue="guidLuaMessageToLocalWorker"/>
                    </Filter>
                    <Interface Name="IDkmCustomMessageForwardReceiver"/>
                </InterfaceGroup>
            </Implements>
        </Class>
    </ManagedComponent>
</Configuration>

But when I send a message from an IDE component to this component, it is not executed in a worker process. DkmCustomMessage.Create(process.Connection, process, MessageToLocalWorker.guid, MessageToLocalWorker.checkSymbol, nativeModuleInstance.UniqueId.ToByteArray(), null).SendLower();

image

WheretIB commented 4 years ago

Checked documentation again, the message should be sent using an existing or new worker connection:

var workerConnection = DkmWorkerProcessConnection.Current();

if (workerConnection == null)
    workerConnection = DkmWorkerProcessConnection.Open(null);

DkmCustomMessage.Create(process.Connection, process, MessageToLocalWorker.guid, MessageToLocalWorker.checkSymbol, nativeModuleInstance.UniqueId.ToByteArray(), null, null, workerConnection).SendLower();

Sorry for the trouble.