Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pid to determine program if one is not configured for local attach #1230

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,11 @@ protected override void HandleAttachRequestAsync(IRequestResponder<AttachArgumen
SetCommonDebugSettings(responder.Arguments.ConfigurationProperties);

string program = responder.Arguments.ConfigurationProperties.GetValueAsString("program");
if (isLocal && string.IsNullOrWhiteSpace(program))
{
program = Process.GetProcessById(pid).MainModule.FileName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downstream in MICore they still have a hard check for program that it grabs from the ConfigurationProperties JSON object.
See string launchJson = JsonConvert.SerializeObject(responder.Arguments.ConfigurationProperties); below.

You will need to set it for it not to fail the PathExe check in MICore.

responder.Arguments.ConfigurationProperties["program"] = program;

responder.Arguments.ConfigurationProperties["program"] = program;
}
string executable = null;
bool success = false;
try
Expand Down