Browse Source

fixed small, but annoying bugs in VB Lexer and profiler

pull/21/merge
Siegfried Pammer 14 years ago
parent
commit
cf9a06642b
  1. 18
      src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs
  2. 3
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

18
src/AddIns/Analysis/Profiler/Controller/Data/PerformanceCounterDescriptor.cs

@ -97,15 +97,19 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -97,15 +97,19 @@ namespace ICSharpCode.Profiler.Controller.Data
/// </summary>
public static string GetProcessInstanceName(int pid)
{
PerformanceCounterCategory cat = new PerformanceCounterCategory("Process");
try {
PerformanceCounterCategory cat = new PerformanceCounterCategory("Process");
string[] instances = cat.GetInstanceNames();
foreach (string instance in instances) {
using (PerformanceCounter procIdCounter = new PerformanceCounter("Process", "ID Process", instance, true)) {
int val = (int)procIdCounter.RawValue;
if (val == pid)
return instance;
string[] instances = cat.GetInstanceNames();
foreach (string instance in instances) {
using (PerformanceCounter procIdCounter = new PerformanceCounter("Process", "ID Process", instance, true)) {
int val = (int)procIdCounter.RawValue;
if (val == pid)
return instance;
}
}
} catch (Exception) {
return null;
}
return null;

3
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
char ch = (char)nextChar;
#region XML mode
CheckXMLState(startLocation);
if (inXmlMode && xmlModeStack.Peek().level <= 0 && !xmlModeStack.Peek().isDocumentStart && !xmlModeStack.Peek().inXmlTag) {
if (inXmlMode && xmlModeStack.Count > 0 && xmlModeStack.Peek().level <= 0 && !xmlModeStack.Peek().isDocumentStart && !xmlModeStack.Peek().inXmlTag) {
XmlModeInfo info = xmlModeStack.Peek();
int peek = nextChar;
while (true) {
@ -361,6 +361,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -361,6 +361,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
}
}
[Conditional("DEBUG")]
void CheckXMLState(Location startLocation)
{
if (inXmlMode && !xmlModeStack.Any())

Loading…
Cancel
Save