Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12076Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12076" |
There was a problem hiding this comment.
Pull Request Overview
Adds Java debugger support to the VS Code extension, enabling detection, configuration, and launch handling for Java services.
- Introduces Java launch configuration types and a Java-specific debugger extension.
- Adds capability detection via the Java Extension Pack and updates supported capabilities.
- Provides unit tests for Java getProjectFile behavior and updates README with Java docs.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| extension/src/test/javaDebugger.test.ts | Adds unit tests covering Java getProjectFile logic, precedence, and error cases. |
| extension/src/debugger/languages/java.ts | Implements the Java ResourceDebuggerExtension and getProjectFile resolution. |
| extension/src/debugger/debuggerExtensions.ts | Registers Java debugger extension when Java capability is present. |
| extension/src/dcp/types.ts | Adds JavaLaunchConfiguration type and type guard. |
| extension/src/capabilities.ts | Adds Java capability detection and capability list entries. |
| extension/README.md | Documents Java debugger option and links to VS Code Java debugging docs. |
|
I'll add the new I did hit a weird issue that crashes the Java debugger on startup. It looks like something is introducing duplicate environment variables. Is it possible the Java debugger already merges the launch configuration This is the stacktrace from the Language Support for Java output window: Oct 18, 2025 2:20:25 PM com.microsoft.java.debug.core.adapter.handler.LaunchRequestHandler constructEnvironmentVariables
WARNING: There are duplicated environment variables. The values specified in launch.json will be used. Here are the duplicated entries: ALLUSERSPROFILE,ANDROID_HOME,APPDATA,APPLICATION_INSIGHTS_NO_STATSBEAT,CHROME_CRASHPAD_PIPE_NAME,CommonPropertyBagPath,CommonPropertyBagWithConfigPath,COMPUTERNAME,ComSpec,CommonProgramFiles,CommonProgramFiles(x86),CommonProgramW6432,DOTNET_ROOT,DriverData,EFC_9208_1592913036,ELECTRON_RUN_AS_NODE,FPS_BROWSER_APP_PROFILE_STRING,FPS_BROWSER_USER_PROFILE_STRING,HOMEDRIVE,HOMEPATH,JAVA_HOME,LOCALAPPDATA,LOGONSERVER,NUGET_PACKAGES,NUMBER_OF_PROCESSORS,NVM_HOME,NVM_SYMLINK,ORIGINAL_XDG_CURRENT_DESKTOP,OS,OneDrive,OneDriveConsumer,PATHEXT,POWERSHELL_DISTRIBUTION_CHANNEL,PROCESSOR_ARCHITECTURE,PROCESSOR_IDENTIFIER,PROCESSOR_LEVEL,PROCESSOR_REVISION,PSModulePath,PUBLIC,Path,ProgramData,ProgramFiles,ProgramFiles(x86),ProgramW6432,SESSIONNAME,SystemDrive,SystemRoot,TEMP,TMP,USERDOMAIN,USERDOMAIN_ROAMINGPROFILE,USERNAME,USERPROFILE,VSCODE_CRASH_REPORTER_PROCESS_TYPE,VSCODE_CWD,VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME,VSCODE_ESM_ENTRYPOINT,VSCODE_HANDLES_UNCAUGHT_ERRORS,VSCODE_IPC_HOOK,VSCODE_NLS_CONFIG,VSCODE_PID,ZES_ENABLE_SYSMAN,windir.
[Error - 2:20:25 PM] Oct 18, 2025, 2:20:25 PM [error response][launch]: Failed to launch debuggee VM. Reason: VM exited with status 1
Failed to launch debuggee VM. Reason: VM exited with status 1
com.microsoft.java.debug.core.DebugException: Failed to launch debuggee VM. Reason: VM exited with status 1
at com.microsoft.java.debug.core.adapter.handler.LaunchRequestHandler.launch(LaunchRequestHandler.java:326)
at com.microsoft.java.debug.core.adapter.handler.LaunchRequestHandler.handleLaunchCommand(LaunchRequestHandler.java:193)
at com.microsoft.java.debug.core.adapter.handler.LaunchRequestHandler.handle(LaunchRequestHandler.java:95)
at com.microsoft.java.debug.core.adapter.DebugAdapter.lambda$dispatchRequest$0(DebugAdapter.java:94)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(Unknown Source)
at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:93)
at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:132)
at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$new$0(AbstractProtocolServer.java:81)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source) |
|
You should place a breakpoint right before calling viscode.debug.startDebugging to see the contents of the env property. That may be a good place to start |
…ath and project_path are included
|
There are definitely duplicate environment variables being set, but it looks like they weren't the cause of the crash. It is actually the JVM crashing because the otel agent path. From the Community Toolkit Java example, this works: var executableapp = builder.AddSpringApp("executableapp",
workingDirectory: "../CommunityToolkit.Aspire.Hosting.Java.Spring.Maven",
new JavaAppExecutableResourceOptions()
{
ApplicationName = "target/spring-maven-0.0.1-SNAPSHOT.jar",
Port = 8085,
OtelAgentPath = Path.Combine(Directory.GetCurrentDirectory(), "../../../agents")
})
.WithVSCodeDebugSupport(Path.Combine(Directory.GetCurrentDirectory(), "../CommunityToolkit.Aspire.Hosting.Java.Spring.Maven"), "java", "vscjava.vscode-java-pack")This does not: var executableapp = builder.AddSpringApp("executableapp",
workingDirectory: "../CommunityToolkit.Aspire.Hosting.Java.Spring.Maven",
new JavaAppExecutableResourceOptions()
{
ApplicationName = "target/spring-maven-0.0.1-SNAPSHOT.jar",
Port = 8085,
OtelAgentPath = "../../../agents",
})
.WithVSCodeDebugSupport(Path.Combine(Directory.GetCurrentDirectory(), "../CommunityToolkit.Aspire.Hosting.Java.Spring.Maven"), "java", "vscjava.vscode-java-pack")Nevertheless, it looks like the bug may be in how the Community Toolkit reads the |
Can you update the community toolkit example as well? Thank you for investigating! |
|
Overriding the export const javaDebuggerExtension: ResourceDebuggerExtension = {
resourceType: 'java',
debugAdapter: 'java',
extensionId: 'vscjava.vscode-java-pack',
displayName: 'Java',
getSupportedFileTypes: () => ['.java'],
getProjectFile: (launchConfig) => {
if (isJavaLaunchConfiguration(launchConfig)) {
const programPath = launchConfig.main_class_path || launchConfig.project_path;
if (programPath) {
return programPath;
}
}
throw new Error(invalidLaunchConfiguration(JSON.stringify(launchConfig)));
},
async createDebugSessionConfigurationCallback(launchConfig, args, env, launchOptions, debugConfiguration) {
debugConfiguration.cwd = this.getProjectFile(launchConfig);
}
}; |
|
This should be ready now. |
|
I used the Java example from the Community Toolkit to test this change. The following steps are one way to try this out locally:
You should be able to place breakpoints anywhere inside the Java app. |

Description
This PR introduces Java debugger support for the VSCode extension.
This will require a corresponding change in the Community Toolkit.
cc @adamint
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate