{
throw new UnsupportedCommandException("The target runtime does not support profiler attach");
}
+ if (hr == (uint)DiagnosticsIpcError.ProfilerAlreadyActive)
+ {
+ throw new ProfilerAlreadyActiveException("The request to attach a profiler was denied because a profiler is already loaded");
+ }
throw new ServerErrorException($"Profiler attach failed (HRESULT: 0x{hr:X8})");
case DiagnosticsServerResponseId.OK:
return;
{
public UnsupportedCommandException(string msg): base(msg) {}
}
+
+ // When the runtime already has loaded profiler
+ public class ProfilerAlreadyActiveException : ServerErrorException
+ {
+ public ProfilerAlreadyActiveException(string msg): base(msg) {}
+ }
}
\ No newline at end of file
/// </summary>
internal enum DiagnosticsIpcError : uint
{
- BadEncoding = 0x80131384,
- UnknownCommand = 0x80131385,
- UnknownMagic = 0x80131386,
- UnknownError = 0x80131387
+ ProfilerAlreadyActive = 0x8013136A,
+ BadEncoding = 0x80131384,
+ UnknownCommand = 0x80131385,
+ UnknownMagic = 0x80131386,
+ UnknownError = 0x80131387
}
/// <summary>