Skip to content

Commit 7bdd90c

Browse files
Merge pull request #409 from OmniSharp/dev
Merge dev into master
2 parents d4ca266 + 49c3e37 commit 7bdd90c

File tree

15 files changed

+811
-500
lines changed

15 files changed

+811
-500
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ Please file any issues at https://github.com/OmniSharp/omnisharp-vscode/issues.
2424
### Debugging
2525
The C# extension now supports basic debugging capabilities! See http://aka.ms/vscclrdebugger for details.
2626

27+
### What's new in C# extension version 1.1
28+
29+
* Preliminary support for `dotnet test`
30+
* Fix for OmniSharp installation problems on networks with an http proxy
31+
* Debugger support for an external console
32+
* Debugger support for environment variables
33+
* Support for debugging .NET Core 1.0.0 post RC2 builds
34+
* Automatic web vs. console debugger configuration detection
35+
* Detach support
36+
* Fix expression evaluation errors when referencing assemblies which aren't currently loaded
37+
* Fix expression evaluation on Windows 7
38+
2739
### Development
2840

2941
First install:

coreclr-debug/NuGet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
55
<clear />
66
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
7+
<!-- This dependency can be commented out once we push packages to nuget for a real release -->
8+
<add key="coreclrdebug" value="https://www.myget.org/F/coreclr-debug/api/v3/index.json" />
79
</packageSources>
810
</configuration>

debugger.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,21 @@ You can optionally configure a file by file mapping by providing map following t
116116

117117
"sourceFileMap": {
118118
"C:\foo":"/home/me/foo"
119-
}
119+
}
120120

121121
#####Symbol Path
122122
You can optionally provide paths to symbols following this schema:
123123

124124
"symbolPath":"[ \"/Volumes/symbols\"]"
125+
126+
#####Environment variables
127+
Environment variables may be passed to your program using this schema:
128+
129+
"env": {
130+
"myVariableName":"theValueGoesHere"
131+
}
132+
133+
#####External console (terminal) window
134+
The target process can optionally launch into a seperate console window. You will want this if your console app takes console input (ex: Console.ReadLine). This can be enabled with:
135+
136+
"externalConsole": true

package.json

Lines changed: 110 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "csharp",
33
"publisher": "ms-vscode",
4-
"version": "1.0.12",
4+
"version": "1.1.4",
55
"description": "C# for Visual Studio Code (powered by OmniSharp).",
66
"displayName": "C#",
77
"author": "Microsoft Corporation",
@@ -22,7 +22,7 @@
2222
"postinstall": "tsc"
2323
},
2424
"dependencies": {
25-
"decompress": "^3.0.0",
25+
"decompress": "^4.0.0",
2626
"del": "^2.0.2",
2727
"fs-extra-promise": "^0.3.1",
2828
"http-proxy-agent": "^1.0.0",
@@ -263,6 +263,17 @@
263263
}
264264
}
265265
},
266+
"env": {
267+
"type": "object",
268+
"additionalProperties": { "type": "string" },
269+
"description": "Environment variables passed to the program.",
270+
"default": { }
271+
},
272+
"externalConsole": {
273+
"type": "boolean",
274+
"description": "If 'true' the debugger should launch the target application into a new external console.",
275+
"default": false
276+
},
266277
"sourceFileMap": {
267278
"type": "object",
268279
"description": "Optional source file mappings passed to the debug engine. Example: '{ \"C:\\foo\":\"/home/user/foo\" }'",
@@ -282,6 +293,98 @@
282293
"type": "string"
283294
},
284295
"default": []
296+
},
297+
"pipeTransport": {
298+
"type": "object",
299+
"description": "When present, this tells the debugger to connect to a remote computer using another executable as a pipe that will relay standard input/output between VS Code and the .NET Core debugger backend executable (clrdbg).",
300+
"default": {
301+
"pipeProgram": "enter the fully qualified path for the pipe program name, for example 'c:\\tools\\plink.exe'",
302+
"pipeArgs": []
303+
},
304+
"properties" : {
305+
"pipeProgram": {
306+
"type": "string",
307+
"description": "The fully qualified pipe command to execute.",
308+
"default": "enter the fully qualified path for the pipe program name, for example 'c:\\tools\\plink.exe'"
309+
},
310+
"pipeArgs": {
311+
"type": "array",
312+
"description": "Command line arguments passed to the pipe program.",
313+
"items": {
314+
"type": "string"
315+
},
316+
"default": []
317+
},
318+
"windows": {
319+
"type": "object",
320+
"description": "Windows-specific pipe launch configuration options",
321+
"default": {
322+
"pipeProgram": "enter the fully qualified path for the pipe program name, for example 'c:\\tools\\plink.exe'",
323+
"pipeArgs": []
324+
},
325+
"properties": {
326+
"pipeProgram": {
327+
"type": "string",
328+
"description": "The fully qualified pipe command to execute.",
329+
"default": "enter the fully qualified path for the pipe program name, for example 'c:\\tools\\plink.exe'"
330+
},
331+
"pipeArgs": {
332+
"type": "array",
333+
"description": "Command line arguments passed to the pipe program.",
334+
"items": {
335+
"type": "string"
336+
},
337+
"default": []
338+
}
339+
}
340+
},
341+
"osx": {
342+
"type": "object",
343+
"description": "OSX-specific pipe launch configuration options",
344+
"default": {
345+
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
346+
"pipeArgs": []
347+
},
348+
"properties": {
349+
"pipeProgram": {
350+
"type": "string",
351+
"description": "The fully qualified pipe command to execute.",
352+
"default": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'"
353+
},
354+
"pipeArgs": {
355+
"type": "array",
356+
"description": "Command line arguments passed to the pipe program.",
357+
"items": {
358+
"type": "string"
359+
},
360+
"default": []
361+
}
362+
}
363+
},
364+
"linux": {
365+
"type": "object",
366+
"description": "Linux-specific pipe launch configuration options",
367+
"default": {
368+
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
369+
"pipeArgs": []
370+
},
371+
"properties": {
372+
"pipeProgram": {
373+
"type": "string",
374+
"description": "The fully qualified pipe command to execute.",
375+
"default": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'"
376+
},
377+
"pipeArgs": {
378+
"type": "array",
379+
"description": "Command line arguments passed to the pipe program.",
380+
"items": {
381+
"type": "string"
382+
},
383+
"default": []
384+
}
385+
}
386+
}
387+
}
285388
}
286389
}
287390
},
@@ -330,7 +433,8 @@
330433
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
331434
"args": [],
332435
"cwd": "${workspaceRoot}",
333-
"stopAtEntry": false
436+
"stopAtEntry": false,
437+
"externalConsole": false
334438
},
335439
{
336440
"name": ".NET Core Launch (web)",
@@ -354,6 +458,9 @@
354458
"linux": {
355459
"command": "xdg-open"
356460
}
461+
},
462+
"env": {
463+
"ASPNETCORE_ENVIRONMENT": "Development"
357464
}
358465
},
359466
{

src/assets.ts

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ interface ConsoleLaunchConfiguration extends DebugConfiguration {
2424
program: string,
2525
args: string[],
2626
cwd: string,
27-
stopAtEntry: boolean
27+
stopAtEntry: boolean,
28+
env?: any,
29+
externalConsole?: boolean
2830
}
2931

3032
interface CommandLine {
@@ -137,6 +139,7 @@ function createLaunchConfiguration(targetFramework: string, executableName: stri
137139
program: '${workspaceRoot}/bin/Debug/' + targetFramework + '/'+ executableName,
138140
args: [],
139141
cwd: '${workspaceRoot}',
142+
externalConsole: false,
140143
stopAtEntry: false
141144
}
142145
}
@@ -164,6 +167,9 @@ function createWebLaunchConfiguration(targetFramework: string, executableName: s
164167
linux: {
165168
command: 'xdg-open'
166169
}
170+
},
171+
env: {
172+
ASPNETCORE_ENVIRONMENT: "Development"
167173
}
168174
}
169175
}
@@ -177,14 +183,25 @@ function createAttachConfiguration(): AttachConfiguration {
177183
}
178184
}
179185

180-
function createLaunchJson(targetFramework: string, executableName: string): any {
181-
return {
182-
version: '0.2.0',
183-
configurations: [
184-
createLaunchConfiguration(targetFramework, executableName),
185-
createWebLaunchConfiguration(targetFramework, executableName),
186-
createAttachConfiguration()
187-
]
186+
function createLaunchJson(targetFramework: string, executableName: string, isWebProject: boolean): any {
187+
let version = '0.2.0';
188+
if (!isWebProject) {
189+
return {
190+
version: version,
191+
configurations: [
192+
createLaunchConfiguration(targetFramework, executableName),
193+
createAttachConfiguration()
194+
]
195+
}
196+
}
197+
else {
198+
return {
199+
version: version,
200+
configurations: [
201+
createWebLaunchConfiguration(targetFramework, executableName),
202+
createAttachConfiguration()
203+
]
204+
}
188205
}
189206
}
190207

@@ -220,7 +237,24 @@ function addTasksJsonIfNecessary(info: protocol.DotNetWorkspaceInformation, path
220237
});
221238
}
222239

223-
function addLaunchJsonIfNecessary(info: protocol.DotNetWorkspaceInformation, paths: Paths, operations: Operations) {
240+
function hasWebServerDependency(projectJsonPath: string) {
241+
let projectJson = fs.readFileSync(projectJsonPath, 'utf8');
242+
let projectJsonObject = JSON.parse(projectJson);
243+
244+
if (projectJsonObject == null) {
245+
return false;
246+
}
247+
248+
for (var key in projectJsonObject.dependencies) {
249+
if (key.toLowerCase().startsWith("microsoft.aspnetcore.server")) {
250+
return true;
251+
}
252+
}
253+
254+
return false;
255+
}
256+
257+
function addLaunchJsonIfNecessary(info: protocol.DotNetWorkspaceInformation, paths: Paths, operations: Operations, projectJsonPath: string) {
224258
return new Promise<void>((resolve, reject) => {
225259
if (!operations.addLaunchJson) {
226260
return resolve();
@@ -248,7 +282,7 @@ function addLaunchJsonIfNecessary(info: protocol.DotNetWorkspaceInformation, pat
248282
}
249283
}
250284

251-
const launchJson = createLaunchJson(targetFramework, executableName);
285+
const launchJson = createLaunchJson(targetFramework, executableName, hasWebServerDependency(projectJsonPath));
252286
const launchJsonText = JSON.stringify(launchJson, null, ' ');
253287

254288
return fs.writeFileAsync(paths.launchJsonPath, launchJsonText);
@@ -284,7 +318,7 @@ export function addAssetsIfNecessary(server: OmnisharpServer) {
284318
return fs.ensureDirAsync(paths.vscodeFolder).then(() => {
285319
return Promise.all([
286320
addTasksJsonIfNecessary(info.DotNet, paths, operations),
287-
addLaunchJsonIfNecessary(info.DotNet, paths, operations)
321+
addLaunchJsonIfNecessary(info.DotNet, paths, operations, projectJsonPath)
288322
]);
289323
});
290324
});

src/coreclr-debug/main.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,25 +200,29 @@ function isOnPath(command : string) : boolean {
200200
return false;
201201
}
202202
let fileName = command;
203-
let seperatorChar = ':';
204203
if (process.platform == 'win32') {
205204
// on Windows, add a '.exe', and the path is semi-colon seperatode
206205
fileName = fileName + ".exe";
207-
seperatorChar = ';';
208206
}
209-
210-
let pathSegments: string[] = pathValue.split(seperatorChar);
207+
208+
let pathSegments: string[] = pathValue.split(path.delimiter);
211209
for (let segment of pathSegments) {
212210
if (segment.length === 0 || !path.isAbsolute(segment)) {
213211
continue;
214212
}
215-
213+
216214
const segmentPath = path.join(segment, fileName);
217-
if (CoreClrDebugUtil.existsSync(segmentPath)) {
218-
return true;
215+
216+
try {
217+
if (CoreClrDebugUtil.existsSync(segmentPath)) {
218+
return true;
219+
}
220+
} catch (err) {
221+
// any error from existsSync can be treated as the command not being on the path
222+
continue;
219223
}
220224
}
221-
225+
222226
return false;
223227
}
224228

@@ -332,9 +336,9 @@ function createProjectJson(targetRuntime: string): any
332336
emitEntryPoint: true
333337
},
334338
dependencies: {
335-
"Microsoft.VisualStudio.clrdbg": "14.0.25229-preview-2963841",
336-
"Microsoft.VisualStudio.clrdbg.MIEngine": "14.0.30401-preview-1",
337-
"Microsoft.VisualStudio.OpenDebugAD7": "1.0.20405-preview-1",
339+
"Microsoft.VisualStudio.clrdbg": "14.0.25406-preview-3044032",
340+
"Microsoft.VisualStudio.clrdbg.MIEngine": "14.0.30606-preview-1",
341+
"Microsoft.VisualStudio.OpenDebugAD7": "1.0.20527-preview-1",
338342
"NETStandard.Library": "1.5.0-rc2-24027",
339343
"Newtonsoft.Json": "7.0.1",
340344
"Microsoft.VisualStudio.Debugger.Interop.Portable": "1.0.1",

src/coreclr-debug/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class CoreClrDebugUtil
8383
fs.accessSync(path, fs.F_OK);
8484
return true;
8585
} catch (err) {
86-
if (err.code === 'ENOENT') {
86+
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {
8787
return false;
8888
} else {
8989
throw Error(err.code);

0 commit comments

Comments
 (0)