Browse Source

profiler: modified DefaultProfiler implementation to show error message instead of throwing NotSupportedException in case no profiler was found.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4737 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
4067100222
  1. 2
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  2. 13
      src/Main/Base/Project/Src/Services/Profiler/DefaultProfiler.cs
  3. 6
      src/Main/Base/Project/Src/Services/Profiler/ProfilerService.cs

2
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -49,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -49,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
OnDebugStarted(EventArgs.Empty);
} catch (Exception) {
OnDebugStopped(EventArgs.Empty);
throw new ApplicationException("Can't execute " + "\"" + processStartInfo.FileName + "\"\n");
throw new ApplicationException("Can't execute \"" + processStartInfo.FileName + "\"\n");
}
}

13
src/Main/Base/Project/Src/Services/Profiler/DefaultProfiler.cs

@ -5,7 +5,10 @@ @@ -5,7 +5,10 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core;
using System;
using System.Diagnostics;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Profiling
{
@ -13,16 +16,19 @@ namespace ICSharpCode.SharpDevelop.Profiling @@ -13,16 +16,19 @@ namespace ICSharpCode.SharpDevelop.Profiling
{
public bool CanProfile(ICSharpCode.SharpDevelop.Project.IProject project)
{
return false;
return true;
}
public void Start(System.Diagnostics.ProcessStartInfo info, string outputPath, Action afterFinishedAction)
public void Start(ProcessStartInfo info, string outputPath, Action afterFinishedAction)
{
throw new NotSupportedException();
MessageService.ShowError("Profiling not supported! " +
"No appropriate Profiler AddIn was found.");
afterFinishedAction();
}
public void Dispose()
{
Stop();
}
public bool IsRunning {
@ -33,7 +39,6 @@ namespace ICSharpCode.SharpDevelop.Profiling @@ -33,7 +39,6 @@ namespace ICSharpCode.SharpDevelop.Profiling
public void Stop()
{
throw new NotSupportedException();
}
}
}

6
src/Main/Base/Project/Src/Services/Profiler/ProfilerService.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.SharpDevelop.Profiling @@ -55,7 +55,7 @@ namespace ICSharpCode.SharpDevelop.Profiling
}
public static string GetSessionFileName(IProject project)
{
{
string filename = @"ProfilingSessions\Session" +
DateTime.Now.ToString("yyyyMMdd_HHmmss", CultureInfo.InvariantCulture) +
".sdps";
@ -68,8 +68,10 @@ namespace ICSharpCode.SharpDevelop.Profiling @@ -68,8 +68,10 @@ namespace ICSharpCode.SharpDevelop.Profiling
}
public static void AddSessionToProject(IProject project, string path)
{
{
Action updater = () => {
if (!File.Exists(path))
return;
FileService.OpenFile(path);
if (!project.ReadOnly) {
FileProjectItem file = new FileProjectItem(project, ItemType.Content, "ProfilingSessions\\" + Path.GetFileName(path));

Loading…
Cancel
Save