Skip to content

Commit ea41fa6

Browse files
authored
Merge pull request #5857 from dibarbet/fix_integration_debug
Fix debugging O# integration tests on preview version
2 parents eb0d88d + 7393814 commit ea41fa6

File tree

2 files changed

+47
-15
lines changed

2 files changed

+47
-15
lines changed

.vscode/launch.json

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"request": "launch",
4242
"runtimeExecutable": "${execPath}",
4343
"args": [
44-
"--disable-extensions",
44+
// Create a temp profile that has no extensions / user settings.
45+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
46+
"--profile-temp",
4547
"--extensionDevelopmentPath=${workspaceRoot}",
4648
"--extensionTestsPath=${workspaceRoot}/out/test/featureTests"
4749
],
@@ -63,7 +65,9 @@
6365
"request": "launch",
6466
"runtimeExecutable": "${execPath}",
6567
"args": [
66-
"--disable-extensions",
68+
// Create a temp profile that has no extensions / user settings.
69+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
70+
"--profile-temp",
6771
"${workspaceRoot}/test/integrationTests/testAssets/singleCsproj",
6872
"--extensionDevelopmentPath=${workspaceRoot}",
6973
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -78,7 +82,8 @@
7882
},
7983
"sourceMaps": true,
8084
"outFiles": [
81-
"${workspaceRoot}/dist/*.js"
85+
"${workspaceRoot}/dist/*.js",
86+
"${workspaceRoot}/out/test/**/*.js"
8287
],
8388
"preLaunchTask": "buildDev"
8489
},
@@ -88,7 +93,9 @@
8893
"request": "launch",
8994
"runtimeExecutable": "${execPath}",
9095
"args": [
91-
"--disable-extensions",
96+
// Create a temp profile that has no extensions / user settings.
97+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
98+
"--profile-temp",
9299
"${workspaceRoot}/test/integrationTests/testAssets/BasicRazorApp2_1",
93100
"--extensionDevelopmentPath=${workspaceRoot}",
94101
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -108,7 +115,9 @@
108115
"request": "launch",
109116
"runtimeExecutable": "${execPath}",
110117
"args": [
111-
"--disable-extensions",
118+
// Create a temp profile that has no extensions / user settings.
119+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
120+
"--profile-temp",
112121
"${workspaceRoot}/test/integrationTests/testAssets/slnWithCsproj",
113122
"--extensionDevelopmentPath=${workspaceRoot}",
114123
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -124,7 +133,8 @@
124133
"stopOnEntry": false,
125134
"sourceMaps": true,
126135
"outFiles": [
127-
"${workspaceRoot}/dist/*.js"
136+
"${workspaceRoot}/dist/*.js",
137+
"${workspaceRoot}/out/test/**/*.js"
128138
],
129139
"preLaunchTask": "buildDev"
130140
},
@@ -134,7 +144,9 @@
134144
"request": "launch",
135145
"runtimeExecutable": "${execPath}",
136146
"args": [
137-
"--disable-extensions",
147+
// Create a temp profile that has no extensions / user settings.
148+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
149+
"--profile-temp",
138150
"${workspaceRoot}/test/integrationTests/testAssets/singleCsproj",
139151
"--extensionDevelopmentPath=${workspaceRoot}",
140152
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -150,7 +162,8 @@
150162
"stopOnEntry": false,
151163
"sourceMaps": true,
152164
"outFiles": [
153-
"${workspaceRoot}/dist/*.js"
165+
"${workspaceRoot}/dist/*.js",
166+
"${workspaceRoot}/out/test/**/*.js"
154167
],
155168
"preLaunchTask": "buildDev"
156169
},
@@ -160,7 +173,9 @@
160173
"request": "launch",
161174
"runtimeExecutable": "${execPath}",
162175
"args": [
163-
"--disable-extensions",
176+
// Create a temp profile that has no extensions / user settings.
177+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
178+
"--profile-temp",
164179
"${workspaceRoot}/test/integrationTests/testAssets/BasicRazorApp2_1",
165180
"--extensionDevelopmentPath=${workspaceRoot}",
166181
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -180,7 +195,9 @@
180195
"request": "launch",
181196
"runtimeExecutable": "${execPath}",
182197
"args": [
183-
"--disable-extensions",
198+
// Create a temp profile that has no extensions / user settings.
199+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
200+
"--profile-temp",
184201
"${workspaceRoot}/test/integrationTests/testAssets/slnWithCsproj",
185202
"--extensionDevelopmentPath=${workspaceRoot}",
186203
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -195,7 +212,8 @@
195212
},
196213
"sourceMaps": true,
197214
"outFiles": [
198-
"${workspaceRoot}/dist/*.js"
215+
"${workspaceRoot}/dist/*.js",
216+
"${workspaceRoot}/out/test/**/*.js"
199217
],
200218
"preLaunchTask": "buildDev"
201219
},
@@ -205,7 +223,9 @@
205223
"request": "launch",
206224
"runtimeExecutable": "${execPath}",
207225
"args": [
208-
"--disable-extensions",
226+
// Create a temp profile that has no extensions / user settings.
227+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
228+
"--profile-temp",
209229
"${workspaceRoot}/test/integrationTests/testAssets/slnFilterWithCsproj",
210230
"--extensionDevelopmentPath=${workspaceRoot}",
211231
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -219,7 +239,8 @@
219239
},
220240
"sourceMaps": true,
221241
"outFiles": [
222-
"${workspaceRoot}/dist/*.js"
242+
"${workspaceRoot}/dist/*.js",
243+
"${workspaceRoot}/out/test/**/*.js"
223244
],
224245
"preLaunchTask": "buildDev"
225246
},
@@ -229,7 +250,9 @@
229250
"request": "launch",
230251
"runtimeExecutable": "${execPath}",
231252
"args": [
232-
"--disable-extensions",
253+
// Create a temp profile that has no extensions / user settings.
254+
// This allows us to only have the C# extension + the dotnet runtime installer extension dependency.
255+
"--profile-temp",
233256
"${workspaceRoot}/test/integrationTests/testAssets/slnWithGenerator",
234257
"--extensionDevelopmentPath=${workspaceRoot}",
235258
"--extensionTestsPath=${workspaceRoot}/out/test/integrationTests"
@@ -243,7 +266,8 @@
243266
},
244267
"sourceMaps": true,
245268
"outFiles": [
246-
"${workspaceRoot}/dist/*.js"
269+
"${workspaceRoot}/dist/*.js",
270+
"${workspaceRoot}/out/test/**/*.js"
247271
],
248272
"preLaunchTask": "buildDev"
249273
},

test/integrationTests/integrationHelpers.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ export interface ActivationResult {
1616
}
1717

1818
export async function activateCSharpExtension(): Promise<ActivationResult> {
19+
// Ensure the dependent extension exists - when launching via F5 launch.json we can't install the extension prior to opening vscode.
20+
const vscodeDotnetRuntimeExtensionId = "ms-dotnettools.vscode-dotnet-runtime";
21+
let dotnetRuntimeExtension = vscode.extensions.getExtension<OmnisharpExtensionExports>(vscodeDotnetRuntimeExtensionId);
22+
if (!dotnetRuntimeExtension) {
23+
await vscode.commands.executeCommand("workbench.extensions.installExtension", vscodeDotnetRuntimeExtensionId);
24+
await vscode.commands.executeCommand("workbench.action.reloadWindow");
25+
}
26+
1927
const configuration = vscode.workspace.getConfiguration();
2028
configuration.update('omnisharp.enableLspDriver', process.env.OMNISHARP_DRIVER === 'lsp' ? true : false);
2129
if (process.env.OMNISHARP_LOCATION) {

0 commit comments

Comments
 (0)