switch ((DiagnosticsServerResponseId)response.Header.CommandId)
{
case DiagnosticsServerResponseId.Error:
- var hr = BitConverter.ToInt32(response.Payload, 0);
+ var hr = BitConverter.ToUInt32(response.Payload, 0);
+ if (hr == (uint)DiagnosticsIpcError.UnknownCommand)
+ {
+ throw new UnsupportedCommandException($"Resume runtime command is unknown by target runtime.");
+ }
throw new ServerErrorException($"Resume runtime failed (HRESULT: 0x{hr:X8})");
case DiagnosticsServerResponseId.OK:
return;
_session = _diagnosticsClient.StartEventPipeSession(Trace.Extensions.ToProviders(providerString), false, 10);
if (_resumeRuntime)
{
- _diagnosticsClient.ResumeRuntime();
+ try
+ {
+ _diagnosticsClient.ResumeRuntime();
+ }
+ catch (UnsupportedCommandException)
+ {
+ // Noop if the command is unknown since the target process is most likely a 3.1 app.
+ }
}
var source = new EventPipeEventSource(_session.EventStream);
source.Dynamic.All += DynamicAllMonitor;
session = diagnosticsClient.StartEventPipeSession(providerCollection, true, (int)buffersize);
if (resumeRuntime)
{
- diagnosticsClient.ResumeRuntime();
+ try
+ {
+ diagnosticsClient.ResumeRuntime();
+ }
+ catch (UnsupportedCommandException)
+ {
+ // Noop if command is unsupported, since the target is most likely a 3.1 app.
+ }
}
}
catch (DiagnosticsClientException e)