@@ -158,6 +158,7 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
158158 const pipeName = `VSCode_${ crypto . randomBytes ( 12 ) . toString ( 'base64' ) } ` ;
159159 const serverName = `\\\\.\\pipe\\WebView2\\Debugger\\${ exeName } \\${ pipeName } ` ;
160160 const targetUrl = this . getWebViewLaunchUrl ( args ) ;
161+ let isAttached = false ;
161162
162163 // Clean up any previous pipe
163164 await new Promise ( ( resolve ) => {
@@ -174,8 +175,9 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
174175 stream . on ( 'data' , async ( data ) => {
175176 const connectionInfo : IWebViewConnectionInfo = JSON . parse ( data . toString ( ) ) ;
176177 const port = this . getWebViewPort ( args , connectionInfo ) ;
177- if ( this . isMatchingWebViewTarget ( connectionInfo , targetUrl ) ) {
178+ if ( ! isAttached && this . isMatchingWebViewTarget ( connectionInfo , targetUrl ) ) {
178179 webViewCreatedCallback ( port ) ;
180+ isAttached = true ;
179181 } else {
180182 const address = args . address || '127.0.0.1' ;
181183 const webSocketUrl = `ws://${ address } :${ port } /devtools/${ connectionInfo . type } /${ connectionInfo . id } `
@@ -191,6 +193,7 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
191193 this . _webviewPipeServer . on ( 'close' , ( ) => {
192194 this . _webviewPipeServer = undefined ;
193195 webViewCreatedCallback ( 0 ) ;
196+ isAttached = true ;
194197 } ) ;
195198
196199 this . _webviewPipeServer . listen ( serverName ) ;
0 commit comments