Skip to content

Commit 56e5265

Browse files
author
Paul van Brenk
committed
Merge branch 'master' into anyCodeFixes
2 parents 7836c14 + 8f9948a commit 56e5265

23 files changed

+336
-419
lines changed

Build/Common.Build.settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
</PropertyGroup>
156156

157157
<PropertyGroup>
158-
<BuildVersionExtended>$(BuildVersion)</BuildVersionExtended>
158+
<BuildVersionExtended>$(BuildVersion) unknown commit</BuildVersionExtended>
159159
<BuildVersionExtended Condition="'$(BUILD_SOURCEVERSION)'!=''">$(BuildVersionExtended) commit:$(BUILD_SOURCEVERSION)</BuildVersionExtended>
160160

161161
<VSIXBuildVersion>$(BuildVersion)</VSIXBuildVersion>

Build/xTVS.ruleset

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
<RuleSet Name="xTVS Coding Rules" Description="xTVS ruleset with low-value tests disabled." ToolsVersion="10.0">
33
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
44
<Rule Id="CA2204" Action="None" />
5-
<Rule Id="CA2210" Action="None" /> <!-- mt.exe problem with signing -->
6-
5+
<Rule Id="CA2210" Action="None" />
6+
<!-- mt.exe problem with signing -->
77
<Rule Id="CA1001" Action="Warning" />
88
<Rule Id="CA1009" Action="Warning" />
99
<Rule Id="CA1016" Action="Warning" />
1010
<Rule Id="CA1049" Action="Warning" />
11-
<Rule Id="CA1033" Action="None" /> <!-- Explicit interface implementation on base classes -->
11+
<Rule Id="CA1033" Action="None" />
12+
<!-- Explicit interface implementation on base classes -->
1213
<Rule Id="CA1060" Action="Warning" />
1314
<Rule Id="CA1061" Action="Warning" />
1415
<Rule Id="CA1063" Action="Warning" />
15-
<Rule Id="CA1065" Action="None" /> <!-- Throw from property accessors -->
16+
<Rule Id="CA1065" Action="None" />
17+
<!-- Throw from property accessors -->
1618
<Rule Id="CA1301" Action="Warning" />
1719
<Rule Id="CA1400" Action="Warning" />
1820
<Rule Id="CA1401" Action="Warning" />
@@ -49,7 +51,8 @@
4951
<Rule Id="CA2147" Action="Warning" />
5052
<Rule Id="CA2149" Action="Warning" />
5153
<Rule Id="CA2200" Action="Warning" />
52-
<Rule Id="CA2202" Action="None" /> <!-- Do not dispose objects multiple times -->
54+
<Rule Id="CA2202" Action="None" />
55+
<!-- Do not dispose objects multiple times -->
5356
<Rule Id="CA2207" Action="Warning" />
5457
<Rule Id="CA2212" Action="Warning" />
5558
<Rule Id="CA2213" Action="Warning" />
@@ -66,21 +69,27 @@
6669
<Rule Id="CA2240" Action="Warning" />
6770
<Rule Id="CA2241" Action="Warning" />
6871
<Rule Id="CA2242" Action="Warning" />
69-
70-
<Rule Id="CA1008" Action="None" /> <!-- Enum should have zero value -->
72+
<Rule Id="CA1008" Action="None" />
73+
<!-- Enum should have zero value -->
7174
<Rule Id="CA1013" Action="Warning" />
72-
<Rule Id="CA1303" Action="None" /> <!-- Do not pass literals as localized parameters -->
73-
<Rule Id="CA1308" Action="None" /> <!-- Normalize strings to uppercase -->
74-
<Rule Id="CA1806" Action="None" /> <!-- Do not ignore method results -->
75+
<Rule Id="CA1303" Action="None" />
76+
<!-- Do not pass literals as localized parameters -->
77+
<Rule Id="CA1308" Action="None" />
78+
<!-- Normalize strings to uppercase -->
79+
<Rule Id="CA1806" Action="None" />
80+
<!-- Do not ignore method results -->
7581
<Rule Id="CA1816" Action="Warning" />
7682
<Rule Id="CA1819" Action="Warning" />
7783
<Rule Id="CA1820" Action="Warning" />
7884
<Rule Id="CA1903" Action="Warning" />
79-
<Rule Id="CA2004" Action="None" /> <!-- Remove calls to GC.KeepAlive -->
85+
<Rule Id="CA2004" Action="None" />
86+
<!-- Remove calls to GC.KeepAlive -->
8087
<Rule Id="CA2006" Action="Warning" />
8188
<Rule Id="CA2102" Action="Warning" />
82-
<Rule Id="CA2104" Action="None" /> <!-- Do not declare readonly mutable types -->
83-
<Rule Id="CA2105" Action="None" /> <!-- Array fields should not be read only -->
89+
<Rule Id="CA2104" Action="None" />
90+
<!-- Do not declare readonly mutable types -->
91+
<Rule Id="CA2105" Action="None" />
92+
<!-- Array fields should not be read only -->
8493
<Rule Id="CA2106" Action="Warning" />
8594
<Rule Id="CA2115" Action="Warning" />
8695
<Rule Id="CA2119" Action="Warning" />
@@ -90,11 +99,30 @@
9099
<Rule Id="CA2205" Action="Warning" />
91100
<Rule Id="CA2215" Action="Warning" />
92101
<Rule Id="CA2221" Action="Warning" />
93-
<Rule Id="CA2222" Action="None" /> <!-- Do not decrease inherited member visibility -->
102+
<Rule Id="CA2222" Action="None" />
103+
<!-- Do not decrease inherited member visibility -->
94104
<Rule Id="CA2223" Action="Warning" />
95105
<Rule Id="CA2224" Action="Warning" />
96106
<Rule Id="CA2226" Action="Warning" />
97107
<Rule Id="CA2227" Action="Warning" />
98108
<Rule Id="CA2239" Action="Warning" />
99109
</Rules>
100-
</RuleSet>
110+
<Rules AnalyzerId="Microsoft.VisualStudio.Threading.Analyzers" RuleNamespace="Microsoft.VisualStudio.Threading.Analyzers">
111+
<Rule Id="VSTHRD001" Action="Info" />
112+
<Rule Id="VSTHRD002" Action="Info" />
113+
<Rule Id="VSTHRD003" Action="Info" />
114+
<Rule Id="VSTHRD010" Action="Info" />
115+
<Rule Id="VSTHRD011" Action="Info" />
116+
<Rule Id="VSTHRD012" Action="Info" />
117+
<Rule Id="VSTHRD100" Action="Info" />
118+
<Rule Id="VSTHRD101" Action="Info" />
119+
<Rule Id="VSTHRD102" Action="Info" />
120+
<Rule Id="VSTHRD103" Action="Info" />
121+
<Rule Id="VSTHRD104" Action="Info" />
122+
<Rule Id="VSTHRD105" Action="Info" />
123+
<Rule Id="VSTHRD106" Action="Info" />
124+
<Rule Id="VSTHRD107" Action="Info" />
125+
<Rule Id="VSTHRD108" Action="Info" />
126+
<Rule Id="VSTHRD200" Action="Info" />
127+
</Rules>
128+
</RuleSet>

Nodejs/Product/Nodejs/Guids.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ internal static class Guids
1313

1414
public const string NodejsPackageString = "FE8A8C3D-328A-476D-99F9-2A24B75F8C7F";
1515
public const string NodejsCmdSetString = "695e37e2-c6df-4e0a-8833-f688e4c65f1f";
16-
public const string NodejsDebugLanguageString = "65791609-BA29-49CF-A214-DBFF8AEC3BC2";
1716
public const string NodejsNpmCmdSetString = "9F4B31B4-09AC-4937-A2E7-F4BC02BB7DBA";
1817
public const string NodeToolsWorkspaceCmdSetString = "0D701F33-94A3-421C-9865-6F65E7E4B689";
1918
public const string NodejsProjectFactoryString = "3AF33F2E-1136-4D97-BBB7-1795711AC8B8";
2019
public const string NodejsBaseProjectFactoryString = "9092AA53-FB77-4645-B42D-1CCCA6BD08BD";
2120
public const string TypeScriptLanguageInfoString = "4a0dddb5-7a95-4fbf-97cc-616d07737a77";
22-
public const string TypeScriptDebuggerLanguageInfoString = "87bdf188-e6e8-4fcf-a82a-9b8506e01847";
2321
public const string JadeEditorFactoryString = "6CB69EF8-1329-4DC0-84B4-FA134EA59BE3";
2422
public const string DefaultLanguageServiceString = "8239BEC4-EE87-11D0-8C98-00C04FC2AB22";
2523

@@ -28,11 +26,14 @@ internal static class Guids
2826
//Guid for our formatting service
2927
internal const string JavaScriptFormattingServiceString = "F414C260-6AC0-11CF-B6D1-00AA00BBBB58";
3028

31-
public const string ScriptDebugLanguageString = "F7FA31DA-C32A-11D0-B442-00A0244A1DD2";
32-
3329
// Debug guids
34-
public const string DebugEngine = "FC5B45BA-5B9C-46EA-887A-82073AE065FE";
30+
// However the debugger requires the '{' and '}'
31+
public const string NodejsDebugLanguageString = "{65791609-BA29-49CF-A214-DBFF8AEC3BC2}";
32+
public const string TypeScriptDebuggerLanguageInfoString = "{87bdf188-e6e8-4fcf-a82a-9b8506e01847}";
33+
public const string ScriptDebugLanguageString = "{F7FA31DA-C32A-11D0-B442-00A0244A1DD2}";
34+
3535
public const string DebugProgramProvider = "472CD331-218C-451E-929E-98C9408F11DD";
36+
public const string DebugEngine = "FC5B45BA-5B9C-46EA-887A-82073AE065FE";
3637
public const string RemoteDebugPortSupplier = "A241707C-7DB3-464F-8D3E-F3D33E86AE99";
3738

3839
public static readonly Guid NodejsBaseProjectFactory = new Guid(NodejsBaseProjectFactoryString);

Nodejs/Product/Nodejs/Nodejs.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@
11971197
</ItemGroup>
11981198
<ItemGroup>
11991199
<T4ParameterValues Include="BuildVersion">
1200-
<Value>$(VSIXBuildVersion)</Value>
1200+
<Value>$(BuildVersionExtended)</Value>
12011201
<Visible>false</Visible>
12021202
</T4ParameterValues>
12031203
</ItemGroup>
@@ -1208,6 +1208,9 @@
12081208
<PackageReference Include="Microsoft.VisualStudio.AppDesigner">
12091209
<Version>15.3.0-rc-6162104</Version>
12101210
</PackageReference>
1211+
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.15.7.DesignTime">
1212+
<Version>15.7.1</Version>
1213+
</PackageReference>
12111214
<PackageReference Include="Microsoft.VisualStudio.Telemetry">
12121215
<Version>15.7.942-master669188BE</Version>
12131216
</PackageReference>

Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs

Lines changed: 6 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ internal class NodejsProjectLauncher : IProjectLauncher
3232
private readonly NodejsProjectNode _project;
3333
private int? _testServerPort;
3434

35-
private static readonly Guid WebkitDebuggerGuid = Guid.Parse("4cc6df14-0ab5-4a91-8bb4-eb0bf233d0fe");
36-
private static readonly Guid WebkitPortSupplierGuid = Guid.Parse("4103f338-2255-40c0-acf5-7380e2bea13d");
3735
internal static readonly Guid WebKitDebuggerV2Guid = Guid.Parse("30d423cc-6d0b-4713-b92d-6b2a374c3d89");
3836

3937
public NodejsProjectLauncher(NodejsProjectNode project)
@@ -64,26 +62,20 @@ public int LaunchFile(string file, bool debug)
6462
}
6563

6664
var nodeVersion = Nodejs.GetNodeVersion(nodePath);
67-
var chromeProtocolRequired = nodeVersion >= new Version(8, 0) || CheckDebugProtocolOption();
6865
var startBrowser = ShouldStartBrowser();
6966

7067
// The call to Version.ToString() is safe, since changes to the ToString method are very unlikely, as the current output is widely documented.
71-
if (debug && !chromeProtocolRequired)
68+
if (debug)
7269
{
73-
StartWithDebugger(file);
74-
TelemetryHelper.LogDebuggingStarted("Node6", nodeVersion.ToString());
75-
}
76-
else if (debug && chromeProtocolRequired)
77-
{
78-
if (CheckUseNewChromeDebugProtocolOption())
70+
if (nodeVersion >= new Version(8, 0))
7971
{
8072
StartWithChromeV2Debugger(file, nodePath, startBrowser);
8173
TelemetryHelper.LogDebuggingStarted("ChromeV2", nodeVersion.ToString());
8274
}
8375
else
8476
{
85-
StartAndAttachDebugger(file, nodePath, startBrowser);
86-
TelemetryHelper.LogDebuggingStarted("Chrome", nodeVersion.ToString());
77+
StartWithDebugger(file);
78+
TelemetryHelper.LogDebuggingStarted("Node6", nodeVersion.ToString());
8779
}
8880
}
8981
else
@@ -97,144 +89,13 @@ public int LaunchFile(string file, bool debug)
9789

9890
// todo: move usersettings to separate class, so we can use this from other places.
9991

100-
internal static bool CheckUseNewChromeDebugProtocolOption()
101-
{
102-
var optionString = NodejsDialogPage.LoadString(name: "WebKitVersion", cat: "Debugging");
103-
104-
return !StringComparer.OrdinalIgnoreCase.Equals(optionString, "V1");
105-
}
106-
107-
internal static bool CheckDebugProtocolOption()
108-
{
109-
var optionString = NodejsDialogPage.LoadString(name: "DebugProtocol", cat: "Debugging");
110-
111-
return StringComparer.OrdinalIgnoreCase.Equals(optionString, "chrome");
112-
}
113-
11492
internal static bool CheckEnableDiagnosticLoggingOption()
11593
{
11694
var optionString = NodejsDialogPage.LoadString(name: "DiagnosticLogging", cat: "Debugging");
11795

11896
return StringComparer.OrdinalIgnoreCase.Equals(optionString, "true");
11997
}
12098

121-
internal static string CheckForRegistrySpecifiedNodeParams()
122-
{
123-
var paramString = NodejsDialogPage.LoadString(name: "NodeCmdParams", cat: "Debugging");
124-
125-
return paramString;
126-
}
127-
128-
private void StartAndAttachDebugger(string file, string nodePath, bool startBrowser)
129-
{
130-
// start the node process
131-
var workingDir = _project.GetWorkingDirectory();
132-
var url = GetFullUrl();
133-
var env = GetEnvironmentVariablesString(url);
134-
var interpreterOptions = _project.GetProjectProperty(NodeProjectProperty.NodeExeArguments);
135-
var debugOptions = this.GetDebugOptions();
136-
var script = GetFullArguments(file, includeNodeArgs: false);
137-
138-
var process = NodeDebugger.StartNodeProcessWithInspect(exe: nodePath, script: script, dir: workingDir, env: env, interpreterOptions: interpreterOptions, debugOptions: debugOptions);
139-
process.Start();
140-
141-
// setup debug info and attach
142-
var debugUri = $"http://127.0.0.1:{process.DebuggerPort}";
143-
144-
var dbgInfo = new VsDebugTargetInfo4();
145-
dbgInfo.dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_AlreadyRunning;
146-
dbgInfo.LaunchFlags = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd;
147-
148-
dbgInfo.guidLaunchDebugEngine = WebkitDebuggerGuid;
149-
dbgInfo.dwDebugEngineCount = 1;
150-
151-
var enginesPtr = MarshalDebugEngines(new[] { WebkitDebuggerGuid });
152-
dbgInfo.pDebugEngines = enginesPtr;
153-
dbgInfo.guidPortSupplier = WebkitPortSupplierGuid;
154-
dbgInfo.bstrPortName = debugUri;
155-
dbgInfo.fSendToOutputWindow = 0;
156-
157-
// we connect through a URI, so no need to set the process,
158-
// we need to set the process id to '1' so the debugger is able to attach
159-
dbgInfo.bstrExe = $"\01";
160-
161-
AttachDebugger(dbgInfo);
162-
163-
if (startBrowser)
164-
{
165-
Uri uri = null;
166-
if (!String.IsNullOrWhiteSpace(url))
167-
{
168-
uri = new Uri(url);
169-
}
170-
171-
if (uri != null)
172-
{
173-
OnPortOpenedHandler.CreateHandler(
174-
uri.Port,
175-
shortCircuitPredicate: () => process.HasExited,
176-
action: () =>
177-
{
178-
VsShellUtilities.OpenBrowser(url, (uint)__VSOSPFLAGS.OSP_LaunchNewBrowser);
179-
}
180-
);
181-
}
182-
}
183-
}
184-
185-
private NodeDebugOptions GetDebugOptions()
186-
{
187-
var debugOptions = NodeDebugOptions.None;
188-
189-
if (NodejsPackage.Instance.GeneralOptionsPage.WaitOnAbnormalExit)
190-
{
191-
debugOptions |= NodeDebugOptions.WaitOnAbnormalExit;
192-
}
193-
194-
if (NodejsPackage.Instance.GeneralOptionsPage.WaitOnNormalExit)
195-
{
196-
debugOptions |= NodeDebugOptions.WaitOnNormalExit;
197-
}
198-
199-
return debugOptions;
200-
}
201-
202-
private void AttachDebugger(VsDebugTargetInfo4 dbgInfo)
203-
{
204-
var serviceProvider = _project.Site;
205-
206-
var debugger = serviceProvider.GetService(typeof(SVsShellDebugger)) as IVsDebugger4;
207-
208-
if (debugger == null)
209-
{
210-
throw new InvalidOperationException("Failed to get the debugger service.");
211-
}
212-
213-
var launchResults = new VsDebugTargetProcessInfo[1];
214-
debugger.LaunchDebugTargets4(1, new[] { dbgInfo }, launchResults);
215-
}
216-
217-
private static IntPtr MarshalDebugEngines(Guid[] debugEngines)
218-
{
219-
if (debugEngines.Length == 0)
220-
{
221-
return IntPtr.Zero;
222-
}
223-
224-
var guidSize = Marshal.SizeOf(typeof(Guid));
225-
var size = debugEngines.Length * guidSize;
226-
var bytes = new byte[size];
227-
for (var i = 0; i < debugEngines.Length; ++i)
228-
{
229-
debugEngines[i].ToByteArray().CopyTo(bytes, i * guidSize);
230-
}
231-
232-
var pDebugEngines = Marshal.AllocCoTaskMem(size);
233-
Marshal.Copy(bytes, 0, pDebugEngines, size);
234-
235-
return pDebugEngines;
236-
}
237-
23899
private void StartNodeProcess(string file, string nodePath, bool startBrowser)
239100
{
240101
//TODO: looks like this duplicates a bunch of code in NodeDebugger
@@ -385,6 +246,8 @@ private void StartWithChromeV2Debugger(string file, string nodePath, bool startB
385246
}
386247

387248
var runtimeArguments = ConvertArguments(this._project.GetProjectProperty(NodeProjectProperty.NodeExeArguments));
249+
// If we supply the port argument we also need to manually add --inspect-brk=port to the runtime arguments
250+
runtimeArguments = runtimeArguments.Append($"--inspect-brk=${debuggerPort}");
388251
var scriptArguments = ConvertArguments(this._project.GetProjectProperty(NodeProjectProperty.ScriptArguments));
389252

390253
var cwd = _project.GetWorkingDirectory(); // Current working directory

Nodejs/Product/Nodejs/SharedProject/AssemblyReferenceNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ protected virtual void OnAssemblyReferenceChangedOnDisk(object sender, FileChang
400400
}
401401

402402
// We only care about file deletes, so check for one before enumerating references.
403-
if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) == 0)
403+
if (e.FileChange != WatcherChangeTypes.Deleted)
404404
{
405405
return;
406406
}

0 commit comments

Comments
 (0)