Skip to content

Conversation

@arekzaluski
Copy link
Contributor

What it does

This PR solves the problem when multiple plugins try to register debug configuration provider under the same handle number. Currently the old provider gets replaced. After this change the new number will be assigned.

Similar guard exists already in registerDebugAdapterContribution

How to test

Follow-ups

Review checklist

Reminder for reviewers

Comment on lines +100 to +106
if (this.configurationProviders.has(provider.handle)) {
const configuration = this.configurationProviders.get(provider.handle);
if (configuration && configuration.type !== provider.type) {
console.warn(`Different debug configuration provider with type '${configuration.type}' already registered.`);
provider.handle = this.configurationProviders.size;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Different way of solving it is the approach from registerDebugAdapterContribution. Instead of assigning a new handle number we can return Disposable.NULL

Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me! 👍

@JonasHelming
Copy link
Contributor

@thegecko If you merge now, it is the todays release :-)

@vince-fugnitto vince-fugnitto added the debug issues that related to debug functionality label Dec 21, 2023
@thegecko thegecko merged commit 118e514 into eclipse-theia:master Dec 21, 2023
@vince-fugnitto vince-fugnitto added this to the 1.45.0 milestone Dec 21, 2023
arekzaluski added a commit to ARMmbed/theia that referenced this pull request Dec 22, 2023
kittaakos added a commit to kittaakos/theia that referenced this pull request Mar 7, 2025
When frontend and main VS Code extensions load together, Theia creates
two extension host instances to manage different kinds of extensions.
Each will register the extensions' contributed debug adapter
configuration providers with incremented handles.

In cases of handle collisions during the registration of debug
configurations, Theia adjusts the handle of incoming providers.
However, this adjustment causes issues as the extension host no longer
associates the new handle with the original ID.

For instance, if the main VSIX contributes two debuggers assigned
handles `0` and `1`, and the web VSIX contributes a debugger with a
colliding handle `0`, Theia changes the web provider's handle to `2`.
Subsequently, when starting a debug session, the main extension
attempts to resolve handle `2`, but the frontend extension host only
recognizes the initial configuration.

This commit addresses the issue by storing the original handle of the
debug adapter configuration. During handle ID lookups, it will
reference the originally assigned handle instead of the adjusted one,
ensuring proper resolution and functionality across both extension host
instances.

Ref: eclipse-theia#13196
rschnekenbu pushed a commit that referenced this pull request Mar 13, 2025
When frontend and main VS Code extensions load together, Theia creates
two extension host instances to manage different kinds of extensions.
Each will register the extensions' contributed debug adapter
configuration providers with incremented handles.

In cases of handle collisions during the registration of debug
configurations, Theia adjusts the handle of incoming providers.
However, this adjustment causes issues as the extension host no longer
associates the new handle with the original ID.

For instance, if the main VSIX contributes two debuggers assigned
handles `0` and `1`, and the web VSIX contributes a debugger with a
colliding handle `0`, Theia changes the web provider's handle to `2`.
Subsequently, when starting a debug session, the main extension
attempts to resolve handle `2`, but the frontend extension host only
recognizes the initial configuration.

This commit addresses the issue by storing the original handle of the
debug adapter configuration. During handle ID lookups, it will
reference the originally assigned handle instead of the adjusted one,
ensuring proper resolution and functionality across both extension host
instances.

Ref: #13196
laemmleint pushed a commit to mvtecsoftware/theia that referenced this pull request Aug 18, 2025
When frontend and main VS Code extensions load together, Theia creates
two extension host instances to manage different kinds of extensions.
Each will register the extensions' contributed debug adapter
configuration providers with incremented handles.

In cases of handle collisions during the registration of debug
configurations, Theia adjusts the handle of incoming providers.
However, this adjustment causes issues as the extension host no longer
associates the new handle with the original ID.

For instance, if the main VSIX contributes two debuggers assigned
handles `0` and `1`, and the web VSIX contributes a debugger with a
colliding handle `0`, Theia changes the web provider's handle to `2`.
Subsequently, when starting a debug session, the main extension
attempts to resolve handle `2`, but the frontend extension host only
recognizes the initial configuration.

This commit addresses the issue by storing the original handle of the
debug adapter configuration. During handle ID lookups, it will
reference the originally assigned handle instead of the adjusted one,
ensuring proper resolution and functionality across both extension host
instances.

Ref: eclipse-theia#13196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debug issues that related to debug functionality

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants