Browse Source

Use LoggingService instead of Console.WriteLine.

Fixed a little bug in attribute completion.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@343 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
040a8b7582
  1. 4
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/CodeDOMGenerator.cs
  2. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/XmlDesignerGenerator.cs
  3. 3
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/NRefactoryDesignerLoader.cs
  4. 1
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/XmlDesignerLoader.cs
  5. 4
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
  6. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormKeyHandler.cs
  7. 4
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/ComponentLibraryLoader.cs
  8. 8
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/CustomComponentsSideTab.cs
  9. 4
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/SideTabDesigner.cs
  10. 6
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DefaultServiceContainer.cs
  11. 27
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/ToolboxService.cs
  12. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/TypeResolutionService.cs
  13. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/ToolboxProvider.cs
  14. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/CodeCompletionWindow.cs
  15. 8
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaManager.cs
  16. 6
      src/AddIns/Misc/NUnitPad/Project/Src/Gui/NUnitPadContent.cs
  17. 15
      src/AddIns/Misc/NUnitPad/Project/Src/Gui/TestTreeView.cs
  18. 13
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs
  19. 10
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs
  20. 3
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs
  21. 6
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  22. 1
      src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClient.cs
  23. 2
      src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj
  24. 1
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/DefaultLineManager.cs
  25. 60
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Caret.cs
  26. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs
  27. 28
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
  28. 16
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaClipboardHandler.cs
  29. 3
      src/Libraries/NRefactory/Project/Src/Output/SpecialNodesInserter.cs
  30. 2
      src/Main/Base/Project/Src/Dom/ExpressionContext.cs
  31. 2
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
  32. 7
      src/Main/Base/Project/Src/Dom/ResolveResult.cs
  33. 14
      src/Main/Base/Project/Src/Dom/XmlDoc.cs
  34. 2
      src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs
  35. 2
      src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs
  36. 2
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionFolderNode.cs
  37. 3
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/Util/ProjectBrowserTreeNodeVisitor.cs
  38. 4
      src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs
  39. 2
      src/Main/Base/Project/Src/Internal/Templates/CodeTemplateLoader.cs
  40. 4
      src/Main/Base/Project/Src/Project/MSBuildEngine.cs
  41. 1
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  42. 2
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  43. 8
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  44. 33
      src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
  45. 4
      src/Main/Base/Project/Src/Services/ProjectService/ParseableFileContentEnumerator.cs
  46. 4
      src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs
  47. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionData.cs
  48. 6
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
  49. 10
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataUsageCache.cs
  50. 13
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs
  51. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs
  52. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs
  53. 8
      src/Main/Core/Project/ICSharpCode.Core.csproj
  54. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs
  55. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/Codon.cs
  56. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/Runtime.cs
  57. 4
      src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs
  58. 120
      src/Main/Core/Project/Src/Services/LoggingService/LoggingService.cs
  59. 23
      src/Main/Core/Project/Src/Services/MessageService/MessageService.cs
  60. 35
      src/Main/StartUp/Project/SharpDevelop.exe.config
  61. 125
      src/Main/StartUp/Project/SharpDevelopMain.cs

4
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/CodeDOMGenerator.cs

@ -47,6 +47,7 @@ namespace ICSharpCode.FormDesigner
public void ConvertContentDefinition(TextWriter writer) public void ConvertContentDefinition(TextWriter writer)
{ {
LoggingService.Info("Start CodeCOMGenerator.ConvertContentDefinition");
DesignerSerializationManager serializationManager = (DesignerSerializationManager)host.GetService(typeof(IDesignerSerializationManager)); DesignerSerializationManager serializationManager = (DesignerSerializationManager)host.GetService(typeof(IDesignerSerializationManager));
IDisposable session = serializationManager.CreateSession(); IDisposable session = serializationManager.CreateSession();
DesignerResourceService designerResourceService = (DesignerResourceService)host.GetService(typeof(System.ComponentModel.Design.IResourceService)); DesignerResourceService designerResourceService = (DesignerResourceService)host.GetService(typeof(System.ComponentModel.Design.IResourceService));
@ -67,7 +68,6 @@ namespace ICSharpCode.FormDesigner
options.IndentString = "\t\t\t"; options.IndentString = "\t\t\t";
// ICSharpCode.NRefactory.Parser.CodeDOMVerboseOutputGenerator outputGenerator = new ICSharpCode.NRefactory.Parser.CodeDOMVerboseOutputGenerator(); // ICSharpCode.NRefactory.Parser.CodeDOMVerboseOutputGenerator outputGenerator = new ICSharpCode.NRefactory.Parser.CodeDOMVerboseOutputGenerator();
// Console.WriteLine("<<<<START.");
foreach (CodeStatement statement in statements) { foreach (CodeStatement statement in statements) {
if (!(statement is CodeVariableDeclarationStatement)) { if (!(statement is CodeVariableDeclarationStatement)) {
@ -86,7 +86,7 @@ namespace ICSharpCode.FormDesigner
} }
designerResourceService.SerializationEnded(true); designerResourceService.SerializationEnded(true);
session.Dispose(); session.Dispose();
// Console.WriteLine("<<<<END."); LoggingService.Info("End CodeCOMGenerator.ConvertContentDefinition");
} }
} }
} }

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/XmlDesignerGenerator.cs

@ -126,7 +126,7 @@ namespace ICSharpCode.FormDesigner
try { try {
propertyValue = pd.GetValue(o); propertyValue = pd.GetValue(o);
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine(e); ICSharpCode.Core.LoggingService.Warn(e);
continue; continue;
} }

3
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/NRefactoryDesignerLoader.cs

@ -78,7 +78,6 @@ namespace ICSharpCode.FormDesigner
protected override ITypeResolutionService TypeResolutionService { protected override ITypeResolutionService TypeResolutionService {
get { get {
Console.WriteLine("type resolution service");
return typeResolutionService; return typeResolutionService;
} }
} }
@ -109,7 +108,7 @@ namespace ICSharpCode.FormDesigner
protected override CodeCompileUnit Parse() protected override CodeCompileUnit Parse()
{ {
Console.Write("ParseCompileUnit"); LoggingService.Debug("NRefactoryDesignerLoader.Parse()");
isReloadNeeded = false; isReloadNeeded = false;
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(language, new StringReader(TextContent)); ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(language, new StringReader(TextContent));
p.Parse(); p.Parse();

1
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerLoader/XmlDesignerLoader.cs

@ -79,7 +79,6 @@ namespace ICSharpCode.FormDesigner
object IObjectCreator.CreateObject(string name, XmlElement el) object IObjectCreator.CreateObject(string name, XmlElement el)
{ {
Console.WriteLine("Name:" + name);
string componentName = null; string componentName = null;
if (el != null) { if (el != null) {

4
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs

@ -133,6 +133,8 @@ namespace ICSharpCode.FormDesigner
{ {
if (isInitialized) return; if (isInitialized) return;
isInitialized = true; isInitialized = true;
LoggingService.Info("Form Designer: BEGIN INITIALIZE");
DefaultServiceContainer serviceContainer = new DefaultServiceContainer(); DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService()); serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService); serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
@ -166,7 +168,7 @@ namespace ICSharpCode.FormDesigner
designSurface.Flush(); designSurface.Flush();
generator.Attach(this); generator.Attach(this);
Console.WriteLine("!!!!!! END LOAD"); LoggingService.Info("Form Designer: END INITIALIZE");
} }
PropertyContainer propertyContainer = new PropertyContainer(); PropertyContainer propertyContainer = new PropertyContainer();

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormKeyHandler.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.FormDesigner
// formDesigner.SetNextTabIndex(c.PointToScreen(p)); // formDesigner.SetNextTabIndex(c.PointToScreen(p));
// } // }
// } catch (Exception e) { // } catch (Exception e) {
// Console.WriteLine(e); // MessageService.ShowError(e);
// } // }
// } // }
// return false; // return false;

4
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/ComponentLibraryLoader.cs

@ -274,7 +274,7 @@ namespace ICSharpCode.FormDesigner.Gui
} }
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine(e); ICSharpCode.Core.LoggingService.Warn("ComponentLibraryLoader.LoadToolComponentLibrary: " + e.Message);
return false; return false;
} }
return true; return true;
@ -304,7 +304,7 @@ namespace ICSharpCode.FormDesigner.Gui
b.MakeTransparent(); b.MakeTransparent();
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine(e); ICSharpCode.Core.LoggingService.Warn("ComponentLibraryLoader.GetIcon: " + e.Message);
} }
} }

8
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/CustomComponentsSideTab.cs

@ -67,6 +67,7 @@ namespace ICSharpCode.FormDesigner.Gui
Assembly MyResolveEventHandler(object sender, ResolveEventArgs args) Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
{ {
LoggingService.Debug("Form Designer: MyResolve: " + args.Name);
string file = args.Name; string file = args.Name;
int idx = file.IndexOf(','); int idx = file.IndexOf(',');
if (idx >= 0) { if (idx >= 0) {
@ -74,13 +75,16 @@ namespace ICSharpCode.FormDesigner.Gui
} }
try { try {
if (File.Exists(loadingPath + file + ".exe")) { if (File.Exists(loadingPath + file + ".exe")) {
LoggingService.Debug("Form Designer: MyResolve: Load bytes from exe");
return Assembly.Load(GetBytes(loadingPath + file + ".exe")); return Assembly.Load(GetBytes(loadingPath + file + ".exe"));
} }
if (File.Exists(loadingPath + file + ".dll")) { if (File.Exists(loadingPath + file + ".dll")) {
LoggingService.Debug("Form Designer: MyResolve: Load bytes from dll");
return Assembly.Load(GetBytes(loadingPath + file + ".dll")); return Assembly.Load(GetBytes(loadingPath + file + ".dll"));
} }
LoggingService.Info("Form Designer: MyResolve: did not find " + args.Name);
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine("Can't load assembly : " + ex.ToString()); LoggingService.Warn("Form Designer: MyResolve: Can't load assembly", ex);
} }
return null; return null;
} }
@ -173,7 +177,7 @@ namespace ICSharpCode.FormDesigner.Gui
} }
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("Exception : " + e); LoggingService.Warn("Form Designer: ScanProjectAssemblies", e);
} finally { } finally {
AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(MyResolveEventHandler); AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(MyResolveEventHandler);
} }

4
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Gui/SideTabDesigner.cs

@ -136,7 +136,7 @@ namespace ICSharpCode.FormDesigner.Gui
stream.Close(); stream.Close();
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine(e); LoggingService.Warn("Form Designer: GetToolboxItemsFromAssembly", e);
} }
} }
Module[] ms = assembly.GetModules(false); Module[] ms = assembly.GetModules(false);
@ -176,7 +176,7 @@ namespace ICSharpCode.FormDesigner.Gui
try { try {
item.Bitmap = (Bitmap)images[imageName]; item.Bitmap = (Bitmap)images[imageName];
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine("Exception converting bitmap : " + images[imageName] + " : " + ex.ToString()); MessageService.ShowError(ex, "Exception converting bitmap : " + images[imageName] + " : ");
} }
} }
toolBoxItems.Add(item); toolBoxItems.Add(item);

6
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DefaultServiceContainer.cs

@ -13,6 +13,7 @@ using System.Drawing;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Windows.Forms.Design; using System.Windows.Forms.Design;
using ICSharpCode.Core;
namespace ICSharpCode.FormDesigner.Services namespace ICSharpCode.FormDesigner.Services
{ {
@ -99,10 +100,9 @@ namespace ICSharpCode.FormDesigner.Services
public object GetService(System.Type serviceType) public object GetService(System.Type serviceType)
{ {
if (IsServiceMissing(serviceType)) { if (IsServiceMissing(serviceType)) {
Console.WriteLine("request missing service : {0} from Assembly {1} is not aviable.", serviceType, serviceType.Assembly.FullName); LoggingService.InfoFormatted("request missing service : {0} from Assembly {1} is not aviable.", serviceType, serviceType.Assembly.FullName);
// Console.ReadLine();
} else { } else {
// Console.WriteLine("get service : {0} from Assembly {1}.", serviceType, serviceType.Assembly.FullName); LoggingService.DebugFormatted("get service : {0} from Assembly {1}.", serviceType, serviceType.Assembly.FullName);
} }
return serviceContainer.GetService(serviceType); return serviceContainer.GetService(serviceType);
} }

27
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/ToolboxService.cs

@ -11,6 +11,7 @@ using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing.Design; using System.Drawing.Design;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using ICSharpCode.Core;
namespace ICSharpCode.FormDesigner.Services namespace ICSharpCode.FormDesigner.Services
{ {
@ -183,8 +184,7 @@ namespace ICSharpCode.FormDesigner.Services
/// </remarks> /// </remarks>
public void AddCreator(ToolboxItemCreatorCallback creator, string format, IDesignerHost host) public void AddCreator(ToolboxItemCreatorCallback creator, string format, IDesignerHost host)
{ {
//System.Console.WriteLine("\tDefaultToolboxService:AddCreator({0}, {1}, {2})", LoggingService.DebugFormatted("\tDefaultToolboxService:AddCreator({0}, {1}, {2})", creator, format, host);
// creator, format, host);
if (host == null) { if (host == null) {
creators.Add(format, creator); creators.Add(format, creator);
} else { } else {
@ -250,7 +250,7 @@ namespace ICSharpCode.FormDesigner.Services
public ToolboxItem DeserializeToolboxItem(object serializedObject) public ToolboxItem DeserializeToolboxItem(object serializedObject)
{ {
// Console.WriteLine("DeserializeToolboxItem {0}", serializedObject); LoggingService.DebugFormatted("DeserializeToolboxItem {0}", serializedObject);
if (serializedObject is System.Windows.Forms.IDataObject) { if (serializedObject is System.Windows.Forms.IDataObject) {
if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) { if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) {
return (ToolboxItem) ((System.Windows.Forms.IDataObject)serializedObject).GetData(typeof(ToolboxItem)); return (ToolboxItem) ((System.Windows.Forms.IDataObject)serializedObject).GetData(typeof(ToolboxItem));
@ -261,7 +261,7 @@ namespace ICSharpCode.FormDesigner.Services
public ToolboxItem DeserializeToolboxItem(object serializedObject, IDesignerHost host) public ToolboxItem DeserializeToolboxItem(object serializedObject, IDesignerHost host)
{ {
Console.WriteLine("DeserializeToolboxItem {0} host {1}", serializedObject, host); LoggingService.DebugFormatted("DeserializeToolboxItem {0} host {1}", serializedObject, host);
if (serializedObject is System.Windows.Forms.IDataObject) { if (serializedObject is System.Windows.Forms.IDataObject) {
if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) { if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) {
ToolboxItem item = (ToolboxItem) ((System.Windows.Forms.IDataObject)serializedObject).GetData(typeof(ToolboxItem)); ToolboxItem item = (ToolboxItem) ((System.Windows.Forms.IDataObject)serializedObject).GetData(typeof(ToolboxItem));
@ -269,30 +269,26 @@ namespace ICSharpCode.FormDesigner.Services
if (host != null) { if (host != null) {
ArrayList list = (ArrayList)toolboxByHost[host]; ArrayList list = (ArrayList)toolboxByHost[host];
if (list != null && list.Contains(item)) { if (list != null && list.Contains(item)) {
Console.WriteLine("Item1>" + item);
return item; return item;
} }
list = (ArrayList)toolboxByHost[ALL_HOSTS]; list = (ArrayList)toolboxByHost[ALL_HOSTS];
if (list != null && list.Contains(item)) { if (list != null && list.Contains(item)) {
Console.WriteLine("Item2>" + item + " type " + item.GetType());
return item; return item;
} }
} }
} }
} }
Console.WriteLine("return null"); LoggingService.InfoFormatted("DeserializeToolboxItem {0} host {1} return null", serializedObject, host);
return null; return null;
} }
public ToolboxItem GetSelectedToolboxItem() public ToolboxItem GetSelectedToolboxItem()
{ {
// Console.WriteLine("GetSelectedToolboxItem");
return selectedItem; return selectedItem;
} }
public ToolboxItem GetSelectedToolboxItem(IDesignerHost host) public ToolboxItem GetSelectedToolboxItem(IDesignerHost host)
{ {
// Console.WriteLine("GetSelectedToolboxItem host {0}", host);
IList list = (IList)toolboxByHost[host]; IList list = (IList)toolboxByHost[host];
if (list != null && list.Contains(selectedItem)) { if (list != null && list.Contains(selectedItem)) {
return selectedItem; return selectedItem;
@ -307,7 +303,7 @@ namespace ICSharpCode.FormDesigner.Services
public ToolboxItemCollection GetToolboxItems() public ToolboxItemCollection GetToolboxItems()
{ {
// Console.WriteLine("GetToolboxItems"); LoggingService.Debug("ToolboxService: GetToolboxItems");
ToolboxItem[] items = new ToolboxItem[toolboxItems.Count]; ToolboxItem[] items = new ToolboxItem[toolboxItems.Count];
toolboxItems.CopyTo(items); toolboxItems.CopyTo(items);
return new ToolboxItemCollection(items); return new ToolboxItemCollection(items);
@ -315,7 +311,7 @@ namespace ICSharpCode.FormDesigner.Services
public ToolboxItemCollection GetToolboxItems(string category) public ToolboxItemCollection GetToolboxItems(string category)
{ {
// Console.WriteLine("GetToolboxItems category {0}", category); LoggingService.Debug("ToolboxService: GetToolboxItems category " + category);
if (category == null) { if (category == null) {
category = ALL_CATEGORIES; category = ALL_CATEGORIES;
} }
@ -329,7 +325,7 @@ namespace ICSharpCode.FormDesigner.Services
public ToolboxItemCollection GetToolboxItems(string category, IDesignerHost host) public ToolboxItemCollection GetToolboxItems(string category, IDesignerHost host)
{ {
// Console.WriteLine("GetToolboxItems category {0} host {1}", category, host); LoggingService.DebugFormatted("ToolboxService: GetToolboxItems category {0} host {1}", category, host);
if (category == null) { if (category == null) {
category = ALL_CATEGORIES; category = ALL_CATEGORIES;
} }
@ -374,19 +370,16 @@ namespace ICSharpCode.FormDesigner.Services
public bool IsSupported(object serializedObject, ICollection filterAttributes) public bool IsSupported(object serializedObject, ICollection filterAttributes)
{ {
// Console.WriteLine("IsSupported serializedObiect {0} filterAttributes {1}", serializedObject, filterAttributes);
return true; return true;
} }
public bool IsSupported(object serializedObject, IDesignerHost host) public bool IsSupported(object serializedObject, IDesignerHost host)
{ {
// Console.WriteLine("IsSupported serializedObiect {0} host {1}", serializedObject, host);
return true; return true;
} }
public bool IsToolboxItem(object serializedObject) public bool IsToolboxItem(object serializedObject)
{ {
// Console.WriteLine("IsToolboxItem serializedObiect {0}", serializedObject);
if (serializedObject is System.Windows.Forms.IDataObject) { if (serializedObject is System.Windows.Forms.IDataObject) {
if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) { if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) {
return true; return true;
@ -397,7 +390,6 @@ namespace ICSharpCode.FormDesigner.Services
public bool IsToolboxItem(object serializedObject, IDesignerHost host) public bool IsToolboxItem(object serializedObject, IDesignerHost host)
{ {
// Console.WriteLine("IsToolboxItem serializedObiect {0} host {1}", serializedObject, host);
// needed for Toolbox drag & drop // needed for Toolbox drag & drop
if (serializedObject is System.Windows.Forms.IDataObject) { if (serializedObject is System.Windows.Forms.IDataObject) {
if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) { if (((System.Windows.Forms.IDataObject)serializedObject).GetDataPresent(typeof(ToolboxItem))) {
@ -450,13 +442,11 @@ namespace ICSharpCode.FormDesigner.Services
public void SelectedToolboxItemUsed() public void SelectedToolboxItemUsed()
{ {
// Console.WriteLine("SelectedToolboxItemUsed");
FireSelectedItemUsed(); FireSelectedItemUsed();
} }
public object SerializeToolboxItem(ToolboxItem toolboxItem) public object SerializeToolboxItem(ToolboxItem toolboxItem)
{ {
// Console.WriteLine("SerializeToolboxItem");
return null; return null;
} }
@ -473,7 +463,6 @@ namespace ICSharpCode.FormDesigner.Services
public void SetSelectedToolboxItem(ToolboxItem toolboxItem) public void SetSelectedToolboxItem(ToolboxItem toolboxItem)
{ {
// Console.WriteLine("SetSelectedToolboxItem toolboxItem {0}", toolboxItem);
if (toolboxItem != selectedItem) { if (toolboxItem != selectedItem) {
FireSelectedItemChanging(); FireSelectedItemChanging();
selectedItem = toolboxItem; selectedItem = toolboxItem;

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/TypeResolutionService.cs

@ -95,7 +95,7 @@ namespace ICSharpCode.FormDesigner.Services
public void ReferenceAssembly(AssemblyName name) public void ReferenceAssembly(AssemblyName name)
{ {
Console.WriteLine("TODO!!! : Add Assembly reference : " + name); ICSharpCode.Core.LoggingService.Warn("TODO: Add Assembly reference : " + name);
} }
} }
} }

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/ToolboxProvider.cs

@ -122,7 +122,7 @@ namespace ICSharpCode.FormDesigner
SideTabDesigner newTab = new SideTabDesigner(SharpDevelopSideBar.SideBar, category, toolboxService); SideTabDesigner newTab = new SideTabDesigner(SharpDevelopSideBar.SideBar, category, toolboxService);
SideTabs.Add(newTab); SideTabs.Add(newTab);
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("Can't add tab : " + e); ICSharpCode.Core.LoggingService.Warn("Can't add tab : " + e);
} }
} }
} }

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/CodeCompletionWindow.cs

@ -114,7 +114,6 @@ namespace ICSharpCode.XmlEditor
void SetDeclarationViewLocation() void SetDeclarationViewLocation()
{ {
Console.WriteLine("SET DECLARATION VIEW LOCATION.");
// This method uses the side with more free space // This method uses the side with more free space
int leftSpace = Bounds.Left - workingScreen.Left; int leftSpace = Bounds.Left - workingScreen.Left;
int rightSpace = workingScreen.Right - Bounds.Right; int rightSpace = workingScreen.Right - Bounds.Right;
@ -162,7 +161,6 @@ namespace ICSharpCode.XmlEditor
protected override void CaretOffsetChanged(object sender, EventArgs e) protected override void CaretOffsetChanged(object sender, EventArgs e)
{ {
int offset = control.ActiveTextAreaControl.Caret.Offset; int offset = control.ActiveTextAreaControl.Caret.Offset;
//Console.WriteLine("StartOffset {0} endOffset {1} - Offset {2}", startOffset, endOffset, offset);
if (offset < startOffset || offset > endOffset) { if (offset < startOffset || offset > endOffset) {
Close(); Close();
} else { } else {
@ -253,7 +251,6 @@ namespace ICSharpCode.XmlEditor
control.BeginUpdate(); control.BeginUpdate();
if (endOffset - startOffset > 0) { if (endOffset - startOffset > 0) {
//Console.WriteLine("start {0} length {1}", startOffset, endOffset - startOffset);
control.Document.Remove(startOffset, endOffset - startOffset); control.Document.Remove(startOffset, endOffset - startOffset);
control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset); control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset);
} }

8
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaManager.cs

@ -112,7 +112,7 @@ namespace ICSharpCode.XmlEditor
SchemaCompletionDataItems.Add(schemaData); SchemaCompletionDataItems.Add(schemaData);
OnUserSchemaAdded(); OnUserSchemaAdded();
} else { } else {
Console.WriteLine(String.Concat("Trying to add a schema that already exists. Namespace=", schemaData.NamespaceUri)); LoggingService.Warn("Trying to add a schema that already exists. Namespace=" + schemaData.NamespaceUri);
} }
} }
@ -155,14 +155,14 @@ namespace ICSharpCode.XmlEditor
schemas.Add(data); schemas.Add(data);
} else { } else {
// Namespace already exists. // Namespace already exists.
Console.WriteLine(String.Concat("Ignoring duplicate schema namespace ", data.NamespaceUri)); LoggingService.Warn("Ignoring duplicate schema namespace " + data.NamespaceUri);
} }
} else { } else {
// Namespace is null. // Namespace is null.
Console.WriteLine(String.Concat("Ignoring schema with no namespace ", data.FileName)); LoggingService.Warn("Ignoring schema with no namespace " + data.FileName);
} }
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine(String.Concat("Unable to read schema '", fileName, "'. ", ex.Message)); LoggingService.Warn("Unable to read schema '" + fileName + "'. ", ex);
} }
} }

6
src/AddIns/Misc/NUnitPad/Project/Src/Gui/NUnitPadContent.cs

@ -213,16 +213,14 @@ namespace ICSharpCode.NUnitPad
} }
if (referenceFound) { if (referenceFound) {
string outputAssembly = project.OutputAssemblyFullPath; string outputAssembly = project.OutputAssemblyFullPath;
LoggingService.Debug("NUnitPad: Load " + outputAssembly);
try { try {
TestDomain testDomain = new TestDomain(); TestDomain testDomain = new TestDomain();
// NUnitProject prj = NUnitProject.LoadProject(outputAssembly);
Test test = testDomain.Load(outputAssembly); Test test = testDomain.Load(outputAssembly);
// TestSuiteBuilder builder = new TestSuiteBuilder();
// Console.WriteLine("Try to load '" + outputAssembly +"'");
// Test testDomain = builder.Build(outputAssembly);
testTreeView.PrintTests(outputAssembly, test, project); testTreeView.PrintTests(outputAssembly, test, project);
} catch (Exception e) { } catch (Exception e) {
LoggingService.Warn("NUnitPad load error", e);
testTreeView.PrintTestErrors(outputAssembly, e); testTreeView.PrintTestErrors(outputAssembly, e);
} }
} }

15
src/AddIns/Misc/NUnitPad/Project/Src/Gui/TestTreeView.cs

@ -163,7 +163,6 @@ namespace ICSharpCode.NUnitPad
public void PrintTests(string assembly, Test test, IProject project) public void PrintTests(string assembly, Test test, IProject project)
{ {
Console.WriteLine(assembly);
TreeNode assemblyNode = new TreeNode(Path.GetFileName(assembly)); TreeNode assemblyNode = new TreeNode(Path.GetFileName(assembly));
assemblyNode.Tag = new TestItemTag(test, project); assemblyNode.Tag = new TestItemTag(test, project);
treeView.Nodes.Add(assemblyNode); treeView.Nodes.Add(assemblyNode);
@ -341,16 +340,9 @@ namespace ICSharpCode.NUnitPad
testRunnerCategory.AppendText(outputMessage + Environment.NewLine); testRunnerCategory.AppendText(outputMessage + Environment.NewLine);
testRunnerCategory.AppendText(result.Description + Environment.NewLine); testRunnerCategory.AppendText(result.Description + Environment.NewLine);
testRunnerCategory.AppendText(result.StackTrace + Environment.NewLine); testRunnerCategory.AppendText(result.StackTrace + Environment.NewLine);
// if (result.StackTrace != null ) {
// Console.WriteLine("result.StackTrace=" + result.StackTrace);
// }
// else {
// Console.WriteLine("result.StackTrace=null");
// }
FileLineReference LineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(result.StackTrace, true); FileLineReference LineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(result.StackTrace, true);
if (LineRef != null) { if (LineRef != null) {
// Console.WriteLine("Adding NUnit error task.");
Task Task = new Task(Path.GetFullPath(LineRef.FileName), Task Task = new Task(Path.GetFullPath(LineRef.FileName),
outputMessage, outputMessage,
LineRef.Column, LineRef.Column,
@ -370,17 +362,10 @@ namespace ICSharpCode.NUnitPad
testRunnerCategory.AppendText(result.Message + Environment.NewLine); testRunnerCategory.AppendText(result.Message + Environment.NewLine);
testRunnerCategory.AppendText(result.Description + Environment.NewLine); testRunnerCategory.AppendText(result.Description + Environment.NewLine);
testRunnerCategory.AppendText(result.StackTrace + Environment.NewLine); testRunnerCategory.AppendText(result.StackTrace + Environment.NewLine);
// if (result.StackTrace != null ) {
// Console.WriteLine("result.StackTrace=" + result.StackTrace);
// }
// else {
// Console.WriteLine("result.StackTrace=null");
// }
FileLineReference LineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(result.StackTrace, true); FileLineReference LineRef = OutputTextLineParser.GetNUnitOutputFileLineReference(result.StackTrace, true);
if (LineRef != null) { if (LineRef != null) {
// Console.WriteLine("Adding NUnit warning task.");
Task Task = new Task(Path.GetFullPath(LineRef.FileName), Task Task = new Task(Path.GetFullPath(LineRef.FileName),
outputMessage, outputMessage,
LineRef.Column, LineRef.Column,

13
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs

@ -51,11 +51,19 @@ namespace ICSharpCode.Svn.Commands
node.AcceptVisitor(visitor, null); node.AcceptVisitor(visitor, null);
} }
bool CanBeVersionControlled(string fileName)
{
string svnDir = Path.Combine(Path.GetDirectoryName(fileName), ".svn");
return Directory.Exists(svnDir);
}
void FileSaved(object sender, FileNameEventArgs e) void FileSaved(object sender, FileNameEventArgs e)
{ {
ProjectBrowserPad pad = ProjectBrowserPad.Instance; ProjectBrowserPad pad = ProjectBrowserPad.Instance;
if (pad == null) return; if (pad == null) return;
FileNode node = pad.ProjectBrowserControl.FindFileNode(e.FileName); string fileName = e.FileName;
if (!CanBeVersionControlled(fileName)) return;
FileNode node = pad.ProjectBrowserControl.FindFileNode(fileName);
if (node == null) return; if (node == null) return;
OverlayIconManager.Enqueue(node); OverlayIconManager.Enqueue(node);
} }
@ -64,6 +72,7 @@ namespace ICSharpCode.Svn.Commands
{ {
try { try {
if (AddInOptions.AutomaticallyAddFiles) { if (AddInOptions.AutomaticallyAddFiles) {
if (!CanBeVersionControlled(e.FileName)) return;
SvnClient.Instance.Client.Add(Path.GetFullPath(e.FileName), false); SvnClient.Instance.Client.Add(Path.GetFullPath(e.FileName), false);
} }
} catch (Exception ex) { } catch (Exception ex) {
@ -77,6 +86,7 @@ namespace ICSharpCode.Svn.Commands
if (e.IsDirectory) return; if (e.IsDirectory) return;
if (!AddInOptions.AutomaticallyDeleteFiles) return; if (!AddInOptions.AutomaticallyDeleteFiles) return;
string fullName = Path.GetFullPath(e.FileName); string fullName = Path.GetFullPath(e.FileName);
if (!CanBeVersionControlled(fullName)) return;
try { try {
Status status = SvnClient.Instance.Client.SingleStatus(fullName); Status status = SvnClient.Instance.Client.SingleStatus(fullName);
switch (status.TextStatus) { switch (status.TextStatus) {
@ -114,6 +124,7 @@ namespace ICSharpCode.Svn.Commands
void FileRenaming(object sender, FileRenamingEventArgs e) void FileRenaming(object sender, FileRenamingEventArgs e)
{ {
string fullSource = Path.GetFullPath(e.SourceFile); string fullSource = Path.GetFullPath(e.SourceFile);
if (!CanBeVersionControlled(fullSource)) return;
try { try {
Status status = SvnClient.Instance.Client.SingleStatus(fullSource); Status status = SvnClient.Instance.Client.SingleStatus(fullSource);
switch (status.TextStatus) { switch (status.TextStatus) {

10
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs

@ -46,12 +46,20 @@ namespace ICSharpCode.Svn
return new ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] { new HistoryView(viewContent) }; return new ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] { new HistoryView(viewContent) };
} }
static Client client;
public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content) public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content)
{ {
if (content.IsUntitled || content.FileName == null || !File.Exists(content.FileName)) { if (content.IsUntitled || content.FileName == null || !File.Exists(content.FileName)) {
return false; return false;
} }
Client client = new Client(); string svnDir = Path.Combine(Path.GetDirectoryName(content.FileName), ".svn");
if (!Directory.Exists(svnDir))
return false;
if (client == null) {
LoggingService.Info("SVN: HistoryViewDisplayBinding initializes client");
client = new Client();
}
Status status = client.SingleStatus(Path.GetFullPath(content.FileName)); Status status = client.SingleStatus(Path.GetFullPath(content.FileName));
return status != null && status.Entry != null; return status != null && status.Entry != null;
} }

3
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs

@ -9,6 +9,7 @@ using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common; using NSvn.Common;
using NSvn.Core; using NSvn.Core;
@ -74,7 +75,7 @@ namespace ICSharpCode.Svn
void GetLogMessages() void GetLogMessages()
{ {
string fileName = Path.GetFullPath(viewContent.FileName); string fileName = Path.GetFullPath(viewContent.FileName);
Console.WriteLine("Get log of " + fileName); LoggingService.Info("SVN: Get log of " + fileName);
if (File.Exists(fileName)) { if (File.Exists(fileName)) {
Client client = SvnClient.Instance.Client; Client client = SvnClient.Instance.Client;
client.Log(new string[] { fileName}, client.Log(new string[] { fileName},

6
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -126,10 +126,14 @@ namespace ICSharpCode.Svn
static void Run() static void Run()
{ {
LoggingService.Debug("SVN: OverlayIconManager Thread started");
while (true) { while (true) {
AbstractProjectBrowserTreeNode node; AbstractProjectBrowserTreeNode node;
lock (queue) { lock (queue) {
if (queue.Count == 0) return; if (queue.Count == 0) {
LoggingService.Debug("SVN: OverlayIconManager Thread finished");
return;
}
node = queue.Dequeue(); node = queue.Dequeue();
} }
try { try {

1
src/AddIns/Misc/SubversionAddIn/Project/Src/SvnClient.cs

@ -221,6 +221,7 @@ namespace ICSharpCode.Svn
SvnClient() SvnClient()
{ {
LoggingService.Info("SVN: SvnClient initialized");
client = new Client(); client = new Client();
client.LogMessage += new LogMessageDelegate(SetLogMessage); client.LogMessage += new LogMessageDelegate(SetLogMessage);
client.Notification += new NotificationDelegate(ReceiveNotification); client.Notification += new NotificationDelegate(ReceiveNotification);

2
src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj

@ -181,4 +181,4 @@
<Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" /> <Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project> </Project>

1
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/DefaultLineManager.cs

@ -170,7 +170,6 @@ namespace ICSharpCode.TextEditor.Document
LineSegment line = (LineSegment)lineCollection[lineNumber]; LineSegment line = (LineSegment)lineCollection[lineNumber];
if ((lineNumber == lineCollection.Count - 1) && removedLineEnds > 0) { if ((lineNumber == lineCollection.Count - 1) && removedLineEnds > 0) {
line.TotalLength -= length; line.TotalLength -= length;
// Console.WriteLine("3:Line length of line {0} set to {1}", lineNumber, line.TotalLength - line.DelimiterLength);
line.DelimiterLength = 0; line.DelimiterLength = 0;
} else { } else {
++lineNumber; ++lineNumber;

60
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Caret.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.TextEditor
InsertMode, InsertMode,
/// <summary> /// <summary>
/// If the caret is in overwirte mode typed characters will /// If the caret is in overwirte mode typed characters will
/// overwrite the character at the caret position /// overwrite the character at the caret position
/// </summary> /// </summary>
OverwriteMode OverwriteMode
@ -212,7 +212,7 @@ namespace ICSharpCode.TextEditor
get { get {
int xpos = textArea.TextView.GetDrawingXPos(this.line, this.column); int xpos = textArea.TextView.GetDrawingXPos(this.line, this.column);
return new Point(textArea.TextView.DrawingPosition.X + xpos, return new Point(textArea.TextView.DrawingPosition.X + xpos,
textArea.TextView.DrawingPosition.Y + (textArea.Document.GetVisibleLine(this.line)) * textArea.TextView.FontHeight - textArea.TextView.TextArea.VirtualTop.Y); textArea.TextView.DrawingPosition.Y + (textArea.Document.GetVisibleLine(this.line)) * textArea.TextView.FontHeight - textArea.TextView.TextArea.VirtualTop.Y);
} }
} }
int oldLine = -1; int oldLine = -1;
@ -228,39 +228,34 @@ namespace ICSharpCode.TextEditor
if (hidden || textArea.MotherTextEditorControl.IsUpdating) { if (hidden || textArea.MotherTextEditorControl.IsUpdating) {
return; return;
} }
try { if (!caretCreated) {
if (!caretCreated) { CreateCaret();
CreateCaret(); }
} if (caretCreated) {
if (caretCreated) { ValidateCaretPos();
ValidateCaretPos(); int lineNr = this.line;
int lineNr = this.line; int xpos = textArea.TextView.GetDrawingXPos(lineNr, this.column);
int xpos = textArea.TextView.GetDrawingXPos(lineNr, this.column); //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
//LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr); Point pos = ScreenPosition;
Point pos = ScreenPosition; if (xpos >= 0) {
if (xpos >= 0) { bool success = SetCaretPos(pos.X, pos.Y);
bool success = SetCaretPos(pos.X, pos.Y); if (!success) {
if (!success) { DestroyCaret();
DestroyCaret(); caretCreated = false;
caretCreated = false; UpdateCaretPosition();
UpdateCaretPosition();
}
}
// set the input method editor location
if (ime == null) {
ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
} else {
ime.Font = textArea.Document.TextEditorProperties.Font;
} }
ime.SetIMEWindowLocation(pos.X + 2,
pos.Y);
currentPos = pos;
} }
} catch (Exception e) { // set the input method editor location
Console.WriteLine("Got exception while update caret position : " + e); if (ime == null) {
ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
} else {
ime.Font = textArea.Document.TextEditorProperties.Font;
}
ime.SetIMEWindowLocation(pos.X + 2,
pos.Y);
currentPos = pos;
} }
} }
public void Dispose() public void Dispose()
@ -291,7 +286,6 @@ namespace ICSharpCode.TextEditor
List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldingsFromPosition(line, column); List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldingsFromPosition(line, column);
bool shouldUpdate = false; bool shouldUpdate = false;
foreach (FoldMarker foldMarker in foldings) { foreach (FoldMarker foldMarker in foldings) {
//Console.WriteLine(foldMarker);
shouldUpdate |= foldMarker.IsFolded; shouldUpdate |= foldMarker.IsFolded;
foldMarker.IsFolded = false; foldMarker.IsFolded = false;
} }

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs

@ -159,7 +159,6 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow
protected override void CaretOffsetChanged(object sender, EventArgs e) protected override void CaretOffsetChanged(object sender, EventArgs e)
{ {
int offset = control.ActiveTextAreaControl.Caret.Offset; int offset = control.ActiveTextAreaControl.Caret.Offset;
//Console.WriteLine("StartOffset {0} endOffset {1} - Offset {2}", startOffset, endOffset, offset);
if (offset < startOffset || offset > endOffset) { if (offset < startOffset || offset > endOffset) {
Close(); Close();
} else { } else {
@ -251,7 +250,6 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow
control.BeginUpdate(); control.BeginUpdate();
if (endOffset - startOffset > 0) { if (endOffset - startOffset > 0) {
//Console.WriteLine("start {0} length {1}", startOffset, endOffset - startOffset);
control.Document.Remove(startOffset, endOffset - startOffset); control.Document.Remove(startOffset, endOffset - startOffset);
control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset); control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset);
} }

28
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs

@ -375,11 +375,7 @@ namespace ICSharpCode.TextEditor
if (updateMargin != null) { if (updateMargin != null) {
try { updateMargin.Paint(g, updateMargin.DrawingPosition);
updateMargin.Paint(g, updateMargin.DrawingPosition);
} catch (Exception ex) {
Console.WriteLine("Got exception : " + ex);
}
// clipRectangle.Intersect(updateMargin.DrawingPosition); // clipRectangle.Intersect(updateMargin.DrawingPosition);
} }
@ -404,11 +400,7 @@ namespace ICSharpCode.TextEditor
if (clipRectangle.IntersectsWith(marginRectangle)) { if (clipRectangle.IntersectsWith(marginRectangle)) {
marginRectangle.Intersect(clipRectangle); marginRectangle.Intersect(clipRectangle);
if (!marginRectangle.IsEmpty) { if (!marginRectangle.IsEmpty) {
try { margin.Paint(g, marginRectangle);
margin.Paint(g, marginRectangle);
} catch (Exception ex) {
Console.WriteLine("Got exception : " + ex);
}
} }
} }
} }
@ -422,23 +414,15 @@ namespace ICSharpCode.TextEditor
if (clipRectangle.IntersectsWith(textViewArea)) { if (clipRectangle.IntersectsWith(textViewArea)) {
textViewArea.Intersect(clipRectangle); textViewArea.Intersect(clipRectangle);
if (!textViewArea.IsEmpty) { if (!textViewArea.IsEmpty) {
try { textView.Paint(g, textViewArea);
textView.Paint(g, textViewArea);
} catch (Exception ex) {
Console.WriteLine("Got exception : " + ex);
}
} }
} }
if (adjustScrollBars) { if (adjustScrollBars) {
try { this.motherTextAreaControl.AdjustScrollBars(null, null);
this.motherTextAreaControl.AdjustScrollBars(null, null);
} catch (Exception) {}
} }
try { Caret.UpdateCaretPosition();
Caret.UpdateCaretPosition();
} catch (Exception) {}
base.OnPaint(e); base.OnPaint(e);
} }
@ -537,8 +521,6 @@ namespace ICSharpCode.TextEditor
} }
} }
} }
} catch (Exception e) {
Console.WriteLine("Got Exception while executing action " + action + " : " + e.ToString());
} finally { } finally {
motherTextEditorControl.EndUpdate(); motherTextEditorControl.EndUpdate();
Caret.UpdateCaretPosition(); Caret.UpdateCaretPosition();

16
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaClipboardHandler.cs

@ -44,14 +44,7 @@ namespace ICSharpCode.TextEditor
public bool EnablePaste { public bool EnablePaste {
get { get {
// Clipboard.GetDataObject may throw an exception... return Clipboard.ContainsText();
try {
IDataObject data = Clipboard.GetDataObject();
return data != null && data.GetDataPresent(DataFormats.Text);
} catch (Exception e) {
Console.WriteLine("Got exception while enablepaste : " + e);
return false;
}
} }
} }
@ -96,8 +89,8 @@ namespace ICSharpCode.TextEditor
OnCopyText(new CopyTextEventArgs(str)); OnCopyText(new CopyTextEventArgs(str));
Clipboard.SetDataObject(dataObject, true); Clipboard.SetDataObject(dataObject, true);
return true; return true;
} catch (Exception e) { } catch (ExternalException) {
Console.WriteLine("Got exception while Copy text to clipboard : " + e);
} }
Thread.Sleep(100); Thread.Sleep(100);
} }
@ -139,8 +132,7 @@ namespace ICSharpCode.TextEditor
textArea.Document.UndoStack.UndoLast(redocounter + 1); // redo the whole operation textArea.Document.UndoStack.UndoLast(redocounter + 1); // redo the whole operation
} } } }
} }
} catch (Exception ex) { } catch (ExternalException) {
Console.WriteLine("Got exception while Paste : " + ex);
} }
} }

3
src/Libraries/NRefactory/Project/Src/Output/SpecialNodesInserter.cs

@ -76,7 +76,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
/// </summary> /// </summary>
public void AcceptNodeStart(INode node) public void AcceptNodeStart(INode node)
{ {
Console.Write("Start node " + node.GetType().Name + ": ");
AcceptPoint(node.StartLocation); AcceptPoint(node.StartLocation);
} }
@ -85,7 +84,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
/// </summary> /// </summary>
public void AcceptNodeEnd(INode node) public void AcceptNodeEnd(INode node)
{ {
Console.Write("End node " + node.GetType().Name + ": ");
AcceptPoint(node.EndLocation); AcceptPoint(node.EndLocation);
} }
@ -94,7 +92,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
/// </summary> /// </summary>
public void AcceptPoint(Point a) public void AcceptPoint(Point a)
{ {
Console.WriteLine(a.Y + ", " + a.X);
while (available) { while (available) {
Point b = enumerator.Current.StartPosition; Point b = enumerator.Current.StartPosition;
if (b.Y < a.Y || (b.Y == a.Y && b.X <= a.X)) { if (b.Y < a.Y || (b.Y == a.Y && b.X <= a.X)) {

2
src/Main/Base/Project/Src/Dom/ExpressionContext.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.SharpDevelop.Dom
/// <remarks>When using this context, a resolver should try resolving typenames with an /// <remarks>When using this context, a resolver should try resolving typenames with an
/// appended "Attribute" suffix and treat "invocations" of the attribute type as /// appended "Attribute" suffix and treat "invocations" of the attribute type as
/// object creation.</remarks> /// object creation.</remarks>
public static ExpressionContext Attribute = new TypeExpressionContext(ProjectContentRegistry.Mscorlib.GetClass("System.Attribute"), true, true); public static ExpressionContext Attribute = new TypeExpressionContext(ProjectContentRegistry.Mscorlib.GetClass("System.Attribute"), false, true);
/// <summary>Context expects a type name which has special base type</summary> /// <summary>Context expects a type name which has special base type</summary>
/// <param name="baseClass">The class the expression must derive from.</param> /// <param name="baseClass">The class the expression must derive from.</param>

2
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -528,7 +528,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
if (e != null) { if (e != null) {
e.Documentation = GetDocumentation(region.BeginLine); e.Documentation = GetDocumentation(region.BeginLine);
} else { } else {
Console.WriteLine("Warning: " + eventDeclaration + " has no events!"); LoggingService.Warn("NRefactoryASTConvertVisitor: " + eventDeclaration + " has no events!");
} }
return null; return null;
} }

7
src/Main/Base/Project/Src/Dom/ResolveResult.cs

@ -202,18 +202,16 @@ namespace ICSharpCode.SharpDevelop.Dom
{ {
ICompilationUnit cu = this.CallingClass.CompilationUnit; ICompilationUnit cu = this.CallingClass.CompilationUnit;
if (cu == null) { if (cu == null) {
Console.WriteLine("callingClass.CompilationUnit is null");
return null; return null;
} }
if (cu.FileName == null || cu.FileName.Length == 0) { if (cu.FileName == null || cu.FileName.Length == 0) {
Console.WriteLine("callingClass.CompilationUnit.FileName is empty");
return null; return null;
} }
IRegion reg = field.Region; IRegion reg = field.Region;
if (reg != null) { if (reg != null) {
return new FilePosition(cu.FileName, new Point(reg.BeginLine, reg.BeginColumn)); return new FilePosition(cu.FileName, new Point(reg.BeginLine, reg.BeginColumn));
} else { } else {
Console.WriteLine("Fieldregion not set!"); LoggingService.Warn("GetDefinitionPosition: field.Region is null");
return new FilePosition(cu.FileName, Point.Empty); return new FilePosition(cu.FileName, Point.Empty);
} }
} }
@ -376,16 +374,13 @@ namespace ICSharpCode.SharpDevelop.Dom
{ {
IClass declaringType = resolvedMember.DeclaringType; IClass declaringType = resolvedMember.DeclaringType;
if (declaringType == null) { if (declaringType == null) {
Console.WriteLine("declaringType is null");
return null; return null;
} }
ICompilationUnit cu = declaringType.CompilationUnit; ICompilationUnit cu = declaringType.CompilationUnit;
if (cu == null) { if (cu == null) {
Console.WriteLine("declaringType.CompilationUnit is null");
return null; return null;
} }
if (cu.FileName == null || cu.FileName.Length == 0) { if (cu.FileName == null || cu.FileName.Length == 0) {
Console.WriteLine("declaringType.CompilationUnit.FileName is empty");
return null; return null;
} }
IRegion reg = resolvedMember.Region; IRegion reg = resolvedMember.Region;

14
src/Main/Base/Project/Src/Dom/XmlDoc.cs

@ -9,11 +9,13 @@ using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml; using System.Xml;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
/// <summary> /// <summary>
/// Description of XmlDoc. /// Class capable of loading xml documentation files. XmlDoc automatically creates a
/// binary cache for big xml files to reduce memory usage.
/// </summary> /// </summary>
public class XmlDoc : IDisposable public class XmlDoc : IDisposable
{ {
@ -116,15 +118,15 @@ namespace ICSharpCode.SharpDevelop.Dom
int len = (int)fs.Length; int len = (int)fs.Length;
loader = new BinaryReader(fs); loader = new BinaryReader(fs);
if (loader.ReadInt64() != magic) { if (loader.ReadInt64() != magic) {
Console.WriteLine("Wrong magic"); LoggingService.Warn("Cannot load XmlDoc: wrong magic");
return false; return false;
} }
if (loader.ReadInt16() != version) { if (loader.ReadInt16() != version) {
Console.WriteLine("Wrong version"); LoggingService.Warn("Cannot load XmlDoc: wrong version");
return false; return false;
} }
if (loader.ReadInt64() != fileDate.Ticks) { if (loader.ReadInt64() != fileDate.Ticks) {
Console.WriteLine("Wrong date"); LoggingService.Info("Not loading XmlDoc: file changed since cache was created");
return false; return false;
} }
fs.Position = loader.ReadInt32(); // go to start of index fs.Position = loader.ReadInt32(); // go to start of index
@ -151,6 +153,7 @@ namespace ICSharpCode.SharpDevelop.Dom
public void Dispose() public void Dispose()
{ {
LoggingService.Debug("Disposing XmlDoc object");
if (loader != null) { if (loader != null) {
loader.Close(); loader.Close();
fs.Close(); fs.Close();
@ -190,12 +193,14 @@ namespace ICSharpCode.SharpDevelop.Dom
public static XmlDoc Load(string fileName) public static XmlDoc Load(string fileName)
{ {
LoggingService.Debug("Loading XmlDoc for " + fileName);
string cacheName = MakeTempPath() + "/" + Path.GetFileNameWithoutExtension(fileName) string cacheName = MakeTempPath() + "/" + Path.GetFileNameWithoutExtension(fileName)
+ "." + fileName.GetHashCode().ToString("x") + ".dat"; + "." + fileName.GetHashCode().ToString("x") + ".dat";
XmlDoc doc; XmlDoc doc;
if (File.Exists(cacheName)) { if (File.Exists(cacheName)) {
doc = new XmlDoc(); doc = new XmlDoc();
if (doc.LoadFromBinary(cacheName, File.GetLastWriteTimeUtc(fileName))) { if (doc.LoadFromBinary(cacheName, File.GetLastWriteTimeUtc(fileName))) {
LoggingService.Debug("XmlDoc: Load from cache successful");
return doc; return doc;
} else { } else {
doc.Dispose(); doc.Dispose();
@ -210,6 +215,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
if (doc.xmlDescription.Count > cacheLength * 2) { if (doc.xmlDescription.Count > cacheLength * 2) {
LoggingService.Debug("XmlDoc: Creating cache");
DateTime date = File.GetLastWriteTimeUtc(fileName); DateTime date = File.GetLastWriteTimeUtc(fileName);
doc.Save(cacheName, date); doc.Save(cacheName, date);
doc.Dispose(); doc.Dispose();

2
src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs

@ -86,7 +86,7 @@ namespace ICSharpCode.SharpDevelop.Gui
imglist.Images.Add(bitmap); imglist.Images.Add(bitmap);
tmp[entry.Key] = ++i; tmp[entry.Key] = ++i;
} else { } else {
Console.WriteLine("can't load bitmap " + entry.Key.ToString() + " using default"); LoggingService.Warn("NewFileDialog: can't load bitmap " + entry.Key.ToString() + " using default");
} }
} }

2
src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
imglist.Images.Add(bitmap); imglist.Images.Add(bitmap);
tmp[entry.Key] = ++i; tmp[entry.Key] = ++i;
} else { } else {
Console.WriteLine("can't load bitmap " + entry.Key.ToString() + " using default"); LoggingService.Warn("NewProjectDialog: can't load bitmap " + entry.Key.ToString() + " using default");
} }
} }

2
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionFolderNode.cs

@ -103,7 +103,7 @@ namespace ICSharpCode.SharpDevelop.Project
SolutionFolderNode folderNode = new SolutionFolderNode(solution, (SolutionFolder)treeObject); SolutionFolderNode folderNode = new SolutionFolderNode(solution, (SolutionFolder)treeObject);
folderNode.AddTo(this); folderNode.AddTo(this);
} else { } else {
Console.WriteLine("unknown tree object : " + treeObject); LoggingService.Warn("SolutionFolderNode.Initialize(): unknown tree object : " + treeObject);
} }
} }

3
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/Util/ProjectBrowserTreeNodeVisitor.cs

@ -6,6 +6,7 @@
// </file> // </file>
using System; using System;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Project namespace ICSharpCode.SharpDevelop.Project
{ {
@ -13,7 +14,7 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
public object Visit(AbstractProjectBrowserTreeNode abstractProjectBrowserTreeNode, object data) public object Visit(AbstractProjectBrowserTreeNode abstractProjectBrowserTreeNode, object data)
{ {
Console.WriteLine("Warning visited default Visit() for : " + abstractProjectBrowserTreeNode); LoggingService.Warn("Warning visited default Visit() for : " + abstractProjectBrowserTreeNode);
abstractProjectBrowserTreeNode.AcceptChildren(this, data); abstractProjectBrowserTreeNode.AcceptChildren(this, data);
return data; return data;
} }

4
src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs

@ -159,9 +159,7 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
MessageService.ShowError(ex, "Exception got."); MessageService.ShowError(ex, "Exception got.");
#if DEBUG #if DEBUG
Console.WriteLine("Stacktrace of source thread:"); LoggingService.Info("Stacktrace of source thread:\n" + callerStack);
Console.WriteLine(callerStack);
Console.WriteLine();
#endif #endif
} }
} }

2
src/Main/Base/Project/Src/Internal/Templates/CodeTemplateLoader.cs

@ -96,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
static CodeTemplateLoader() static CodeTemplateLoader()
{ {
if (!LoadTemplatesFromStream(Path.Combine(PropertyService.ConfigDirectory, TemplateFileName))) { if (!LoadTemplatesFromStream(Path.Combine(PropertyService.ConfigDirectory, TemplateFileName))) {
Console.WriteLine("Templates: can't load user defaults, reading system defaults"); LoggingService.Info("Templates: can't load user defaults, reading system defaults");
if (!LoadTemplatesFromStream(FileUtility.Combine(PropertyService.DataDirectory, "options", TemplateFileName))) { if (!LoadTemplatesFromStream(FileUtility.Combine(PropertyService.DataDirectory, "options", TemplateFileName))) {
MessageService.ShowWarning("${res:Internal.Templates.CodeTemplateLoader.CantLoadTemplatesWarning}"); MessageService.ShowWarning("${res:Internal.Templates.CodeTemplateLoader.CantLoadTemplatesWarning}");
} }

4
src/Main/Base/Project/Src/Project/MSBuildEngine.cs

@ -52,6 +52,8 @@ namespace ICSharpCode.SharpDevelop.Project
public CompilerResults Run(string buildFile, string[] targets) public CompilerResults Run(string buildFile, string[] targets)
{ {
LoggingService.Debug("Run MSBuild on " + buildFile);
// HACK: Workaround for MSBuild bug: // HACK: Workaround for MSBuild bug:
// "unknown" MSBuild projects (projects with unknown type id, e.g. IL-projects) // "unknown" MSBuild projects (projects with unknown type id, e.g. IL-projects)
// are looked up by MSBuild if the project files are MSBuild-compatible. // are looked up by MSBuild if the project files are MSBuild-compatible.
@ -69,6 +71,8 @@ namespace ICSharpCode.SharpDevelop.Project
engine.RegisterLogger(logger); engine.RegisterLogger(logger);
engine.BuildProjectFile(buildFile, targets, properties, null); engine.BuildProjectFile(buildFile, targets, properties, null);
logger.FlushText(); logger.FlushText();
LoggingService.Debug("MSBuild finished");
return results; return results;
} }

1
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -295,7 +295,6 @@ namespace ICSharpCode.SharpDevelop.Project
public static CompilerResults RunMSBuild(string fileName, string target) public static CompilerResults RunMSBuild(string fileName, string target)
{ {
Console.WriteLine("Run : " + fileName);
WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront();
// BeforeBuild(); // BeforeBuild();
MSBuildEngine engine = new MSBuildEngine(); MSBuildEngine engine = new MSBuildEngine();

2
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -309,7 +309,7 @@ namespace ICSharpCode.SharpDevelop.Project
nestedProjectsSection.Append(Environment.NewLine); nestedProjectsSection.Append(Environment.NewLine);
} }
} else { } else {
Console.WriteLine("unknown folder : "+ currentFolder); LoggingService.Warn("Solution.Load(): unknown folder : " + currentFolder);
} }
projectSection.Append("EndProject"); projectSection.Append("EndProject");
projectSection.Append(Environment.NewLine); projectSection.Append(Environment.NewLine);

8
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -198,7 +198,7 @@ namespace ICSharpCode.Core
protected void AddClassToNamespaceListInternal(IClass addClass) protected void AddClassToNamespaceListInternal(IClass addClass)
{ {
if (addClass.IsPartial) { if (addClass.IsPartial) {
Console.WriteLine("Adding partial class " + addClass.Name + " from " + Path.GetFileName(addClass.CompilationUnit.FileName)); LoggingService.Debug("Adding partial class " + addClass.Name + " from " + Path.GetFileName(addClass.CompilationUnit.FileName));
Dictionary<string, IClass> classes = GetClasses(language); Dictionary<string, IClass> classes = GetClasses(language);
CompoundClass compound = null; CompoundClass compound = null;
if (classes.ContainsKey(addClass.FullyQualifiedName)) if (classes.ContainsKey(addClass.FullyQualifiedName))
@ -209,17 +209,17 @@ namespace ICSharpCode.Core
if (compound.Parts[i].CompilationUnit.FileName == addClass.CompilationUnit.FileName) { if (compound.Parts[i].CompilationUnit.FileName == addClass.CompilationUnit.FileName) {
compound.Parts[i] = addClass; compound.Parts[i] = addClass;
compound.UpdateInformationFromParts(); compound.UpdateInformationFromParts();
Console.WriteLine("\tReplaced old part!"); LoggingService.Debug("Replaced old part!");
return; return;
} }
} }
compound.Parts.Add(addClass); compound.Parts.Add(addClass);
compound.UpdateInformationFromParts(); compound.UpdateInformationFromParts();
Console.WriteLine("\tAdded new part!"); LoggingService.Debug("Added new part!");
return; return;
} else { } else {
addClass = new CompoundClass(addClass); addClass = new CompoundClass(addClass);
Console.WriteLine("\tCompound created!"); LoggingService.Debug("Compound created!");
} }
} }

33
src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs

@ -35,17 +35,10 @@ namespace ICSharpCode.Core
mscorlibContent = contents["mscorlib"]; mscorlibContent = contents["mscorlib"];
return contents["mscorlib"]; return contents["mscorlib"];
} }
#if DEBUG LoggingService.Debug("Loading PC for mscorlib...");
Console.WriteLine("Loading mscorlib...");
int time = Environment.TickCount;
#endif
mscorlibContent = new ReflectionProjectContent(typeof(object).Assembly); mscorlibContent = new ReflectionProjectContent(typeof(object).Assembly);
contents["mscorlib"] = mscorlibContent; contents["mscorlib"] = mscorlibContent;
LoggingService.Debug("Finished loading mscorlib");
#if DEBUG
Console.WriteLine("mscorlib loaded in {0} ms", Environment.TickCount - time);
#endif
return mscorlibContent; return mscorlibContent;
} }
} }
@ -95,10 +88,12 @@ namespace ICSharpCode.Core
} }
string shortName = item.Include; string shortName = item.Include;
LoggingService.Debug("Loading PC for " + shortName);
int pos = shortName.IndexOf(','); int pos = shortName.IndexOf(',');
if (pos > 0) if (pos > 0)
shortName = shortName.Substring(0, pos); shortName = shortName.Substring(0, pos);
StatusBarService.ProgressMonitor.BeginTask("Loading " + shortName + "...", 100); StatusBarService.ProgressMonitor.BeginTask("Loading " + shortName + "...", 100);
#if DEBUG #if DEBUG
int time = Environment.TickCount; int time = Environment.TickCount;
@ -139,13 +134,13 @@ namespace ICSharpCode.Core
return contents[item.Include]; return contents[item.Include];
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine("Can't load assembly '{0}' : " + e.Message, item.Include); LoggingService.Debug("Can't load assembly '" + item.Include + "' : " + e.Message);
} }
} catch (BadImageFormatException) { } catch (BadImageFormatException) {
Console.WriteLine("BadImageFormat: " + shortName); LoggingService.Warn("BadImageFormat: " + shortName);
} finally { } finally {
#if DEBUG #if DEBUG
Console.WriteLine("Loaded {0} with {2} in {1}ms", item.Include, Environment.TickCount - time, how); LoggingService.DebugFormatted("Loaded {0} with {2} in {1}ms", item.Include, Environment.TickCount - time, how);
#endif #endif
StatusBarService.ProgressMonitor.Done(); StatusBarService.ProgressMonitor.Done();
} }
@ -188,28 +183,28 @@ namespace ICSharpCode.Core
static Assembly AssemblyResolve(object sender, ResolveEventArgs e) static Assembly AssemblyResolve(object sender, ResolveEventArgs e)
{ {
string shortName = e.Name; string shortName = e.Name;
Console.Write("AssemblyResolve: " + e.Name); LoggingService.Debug("ProjectContentRegistry.AssemblyResolve" + e.Name);
int pos = shortName.IndexOf(','); int pos = shortName.IndexOf(',');
if (pos > 0) if (pos > 0)
shortName = shortName.Substring(0, pos); shortName = shortName.Substring(0, pos);
string path = Path.Combine(lookupDirectory, shortName); string path = Path.Combine(lookupDirectory, shortName);
if (File.Exists(path + ".dll")) { if (File.Exists(path + ".dll")) {
Console.WriteLine(" - found .dll file"); LoggingService.Debug("AssemblyResolve ReflectionOnlyLoadFrom .dll file");
return Assembly.ReflectionOnlyLoadFrom(path + ".dll"); return Assembly.ReflectionOnlyLoadFrom(path + ".dll");
} }
if (File.Exists(path + ".exe")) { if (File.Exists(path + ".exe")) {
Console.WriteLine(" - found .exe file"); LoggingService.Debug("AssemblyResolve ReflectionOnlyLoadFrom .exe file");
return Assembly.ReflectionOnlyLoadFrom(path + ".exe"); return Assembly.ReflectionOnlyLoadFrom(path + ".exe");
} }
if (File.Exists(path)) { if (File.Exists(path)) {
Console.WriteLine(" - found file"); LoggingService.Debug("AssemblyResolve ReflectionOnlyLoadFrom file");
return Assembly.ReflectionOnlyLoadFrom(path); return Assembly.ReflectionOnlyLoadFrom(path);
} }
try { try {
Console.WriteLine(" - try ReflectionOnlyLoad"); LoggingService.Debug("AssemblyResolve trying ReflectionOnlyLoad");
return Assembly.ReflectionOnlyLoad(e.Name); return Assembly.ReflectionOnlyLoad(e.Name);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
Console.WriteLine("AssemblyResolve: " + ex.Message); LoggingService.Warn("AssemblyResolve failed: " + ex.Message);
return null; return null;
} }
} }

4
src/Main/Base/Project/Src/Services/ProjectService/ParseableFileContentEnumerator.cs

@ -130,11 +130,11 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
res = null; res = null;
Console.WriteLine("ParseableFileContentEnumerator: " + ex.Message); LoggingService.Warn("ParseableFileContentEnumerator: " + ex.Message);
return MoveNext(); // skip files that were not found return MoveNext(); // skip files that were not found
} catch (IOException ex) { } catch (IOException ex) {
res = null; res = null;
Console.WriteLine("ParseableFileContentEnumerator: " + ex.Message); LoggingService.Warn("ParseableFileContentEnumerator: " + ex.Message);
return MoveNext(); // skip invalid files return MoveNext(); // skip invalid files
} }
if (nextItem != null && nextItem.ItemType == ItemType.Compile && CanReadAsync(nextItem)) if (nextItem != null && nextItem.ItemType == ItemType.Compile && CanReadAsync(nextItem))

4
src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs

@ -35,14 +35,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
csa = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("C#", this); csa = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("C#", this);
csa.ConversionFlags = ConversionFlags.ShowAccessibility | ConversionFlags.ShowModifiers | ConversionFlags.QualifiedNamesOnlyForReturnTypes | ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames; csa.ConversionFlags = ConversionFlags.ShowAccessibility | ConversionFlags.ShowModifiers | ConversionFlags.QualifiedNamesOnlyForReturnTypes | ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames;
} catch (Exception) { } catch (Exception) {
Console.WriteLine("CSharpAmbience not found -- is the C# backend binding loaded???"); LoggingService.Warn("CSharpAmbience not found -- is the C# backend binding loaded???");
} }
try { try {
vba = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("VBNET", this); vba = (IAmbience)AddInTree.GetTreeNode("/SharpDevelop/Workbench/Ambiences").BuildChildItem("VBNET", this);
vba.ConversionFlags = ConversionFlags.ShowAccessibility | ConversionFlags.ShowModifiers | ConversionFlags.QualifiedNamesOnlyForReturnTypes | ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames; vba.ConversionFlags = ConversionFlags.ShowAccessibility | ConversionFlags.ShowModifiers | ConversionFlags.QualifiedNamesOnlyForReturnTypes | ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames;
} catch (Exception) { } catch (Exception) {
Console.WriteLine("VBNet ambience not found -- is the VB.NET backend binding loaded???"); LoggingService.Warn("VBNet ambience not found -- is the VB.NET backend binding loaded???");
} }
} }

3
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionData.cs

@ -121,7 +121,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
ambience.ConversionFlags = ConversionFlags.None; ambience.ConversionFlags = ConversionFlags.None;
text = ambience.Convert(c); text = ambience.Convert(c);
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames | ConversionFlags.ShowReturnType | ConversionFlags.ShowModifiers; ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames | ConversionFlags.ShowReturnType | ConversionFlags.ShowModifiers;
// Console.WriteLine("Convert : " + c);
description = ambience.Convert(c); description = ambience.Convert(c);
documentation = c.Documentation; documentation = c.Documentation;
GetPriority(c.DotNetName); GetPriority(c.DotNetName);
@ -277,7 +276,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
} while(xml.Read()); } while(xml.Read());
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine("Invalid XML documentation: " + ex.Message); LoggingService.Debug("Invalid XML documentation: " + ex.Message);
return doc; return doc;
} }
return ret.ToString(); return ret.ToString();

6
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs

@ -36,6 +36,12 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (expressionResult.Expression == null || expressionResult.Expression.Length == 0) { if (expressionResult.Expression == null || expressionResult.Expression.Length == 0) {
return; return;
} }
if (LoggingService.IsDebugEnabled) {
if (expressionResult.Context == ExpressionContext.Default)
LoggingService.DebugFormatted("GenerateCompletionData for >>{0}<<", expressionResult.Expression);
else
LoggingService.DebugFormatted("GenerateCompletionData for >>{0}<<, context={1}", expressionResult.Expression, expressionResult.Context);
}
#if DEBUG #if DEBUG
if (DebugMode) { if (DebugMode) {
Debugger.Break(); Debugger.Break();

10
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataUsageCache.cs

@ -64,11 +64,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
using (FileStream fs = new FileStream(CacheFilename, FileMode.Open, FileAccess.Read)) { using (FileStream fs = new FileStream(CacheFilename, FileMode.Open, FileAccess.Read)) {
using (BinaryReader reader = new BinaryReader(fs)) { using (BinaryReader reader = new BinaryReader(fs)) {
if (reader.ReadInt64() != magic) { if (reader.ReadInt64() != magic) {
Console.WriteLine("CodeCompletionDataUsageCache: wrong file magic"); LoggingService.Warn("CodeCompletionDataUsageCache: wrong file magic");
return; return;
} }
if (reader.ReadInt16() != version) { if (reader.ReadInt16() != version) {
Console.WriteLine("CodeCompletionDataUsageCache: unknown file version"); LoggingService.Warn("CodeCompletionDataUsageCache: unknown file version");
return; return;
} }
int itemCount = reader.ReadInt32(); int itemCount = reader.ReadInt32();
@ -86,7 +86,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
} }
} }
Console.WriteLine("Loaded CodeCompletionDataUsageCache (" + dict.Count + " items)"); LoggingService.Info("Loaded CodeCompletionDataUsageCache (" + dict.Count + " items)");
} }
public static void SaveCache() public static void SaveCache()
@ -100,7 +100,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
count = SaveCache(writer); count = SaveCache(writer);
} }
} }
Console.WriteLine("Saved CodeCompletionDataUsageCache (" + count + " of " + dict.Count + " items)"); LoggingService.Info("Saved CodeCompletionDataUsageCache (" + count + " of " + dict.Count + " items)");
} }
static int SaveCache(BinaryWriter writer) static int SaveCache(BinaryWriter writer)
@ -155,7 +155,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
File.Delete(CacheFilename); File.Delete(CacheFilename);
} }
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine("CodeCompletionDataUsageCache.ResetCache(): " + ex.Message); LoggingService.Warn("CodeCompletionDataUsageCache.ResetCache(): " + ex.Message);
} }
} }

13
src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs

@ -110,6 +110,13 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
return; return;
expressionResult.Expression = expressionResult.Expression.Trim(); expressionResult.Expression = expressionResult.Expression.Trim();
if (LoggingService.IsDebugEnabled) {
if (expressionResult.Context == ExpressionContext.Default)
LoggingService.DebugFormatted("ShowInsight for >>{0}<<", expressionResult.Expression);
else
LoggingService.DebugFormatted("ShowInsight for >>{0}<<, context={1}", expressionResult.Expression, expressionResult.Context);
}
// the parser works with 1 based coordinates // the parser works with 1 based coordinates
int caretLineNumber = document.GetLineNumberForOffset(useOffset) + 1; int caretLineNumber = document.GetLineNumberForOffset(useOffset) + 1;
int caretColumn = useOffset - document.GetLineSegment(caretLineNumber).Offset + 1; int caretColumn = useOffset - document.GetLineSegment(caretLineNumber).Offset + 1;
@ -119,11 +126,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
protected virtual void SetupDataProvider(string fileName, IDocument document, ExpressionResult expressionResult, int caretLineNumber, int caretColumn) protected virtual void SetupDataProvider(string fileName, IDocument document, ExpressionResult expressionResult, int caretLineNumber, int caretColumn)
{ {
bool constructorInsight = false; bool constructorInsight = false;
if (expressionResult.Context.IsObjectCreation) { if (expressionResult.Context == ExpressionContext.Attribute) {
constructorInsight = true; constructorInsight = true;
expressionResult.Context = ExpressionContext.Type; } else if (expressionResult.Context.IsObjectCreation) {
} else if (expressionResult.Context == ExpressionContext.Attribute) {
constructorInsight = true; constructorInsight = true;
expressionResult.Context = ExpressionContext.Type;
} }
ResolveResult results = ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, document.TextContent); ResolveResult results = ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, document.TextContent);
if (constructorInsight) { if (constructorInsight) {

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs

@ -500,11 +500,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
// font - has to be static - don't create on each draw // font - has to be static - don't create on each draw
static Font font = font = new Font("Arial", 8.25f); static Font font = font = new Font("Arial", 8.25f);
static StringFormat drawStringFormat = new StringFormat(StringFormatFlags.NoWrap); static StringFormat drawStringFormat = new StringFormat(StringFormatFlags.NoWrap);
// static int drawingCount = 0;
void ComboBoxDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) void ComboBoxDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{ {
// Console.WriteLine("Draw " + (drawingCount++));
ComboBox comboBox = (ComboBox)sender; ComboBox comboBox = (ComboBox)sender;
e.DrawBackground(); e.DrawBackground();

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs

@ -163,7 +163,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
} }
} catch (TreePathNotFoundException) { } catch (TreePathNotFoundException) {
Console.WriteLine(editActionsPath + " doesn't exists in the AddInTree"); LoggingService.Warn("EditAction " + editActionsPath + " doesn't exists in the AddInTree");
} }
} }

8
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -35,6 +35,10 @@
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" /> <Reference Include="System.XML" />
<Reference Include="log4net">
<HintPath>..\..\..\Libraries\log4net\bin\net\1.1\release\log4net.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Resources\ICSharpCode.Core.doc" /> <None Include="Resources\ICSharpCode.Core.doc" />
@ -128,6 +132,10 @@
</Compile> </Compile>
<Compile Include="Src\AddInTree\AddIn\IBuildItemsModifier.cs" /> <Compile Include="Src\AddInTree\AddIn\IBuildItemsModifier.cs" />
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\IncludeDoozer.cs" /> <Compile Include="Src\AddInTree\AddIn\DefaultDoozers\IncludeDoozer.cs" />
<Compile Include="Src\Services\LoggingService\LoggingService.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src\Services\LoggingService" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project> </Project>

2
src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

@ -32,7 +32,7 @@ namespace ICSharpCode.Core
return o; return o;
} }
} }
Console.WriteLine("Cannot create object: " + className); LoggingService.Error("Cannot create object: " + className);
if (!hasShownErrorMessage) { if (!hasShownErrorMessage) {
hasShownErrorMessage = true; hasShownErrorMessage = true;
MessageService.ShowError("Cannot create object: " + className + "\nFuture missing objects will not cause an error message."); MessageService.ShowError("Cannot create object: " + className + "\nFuture missing objects will not cause an error message.");

4
src/Main/Core/Project/Src/AddInTree/AddIn/Codon.cs

@ -102,8 +102,8 @@ namespace ICSharpCode.Core
return action = ConditionFailedAction.Exclude; return action = ConditionFailedAction.Exclude;
} }
} }
} catch (Exception) { } catch {
Console.WriteLine("Exception in AddIn : " + addIn.FileName); LoggingService.Error("Exception while getting failed action from " + addIn.FileName);
throw; throw;
} }
} }

4
src/Main/Core/Project/Src/AddInTree/AddIn/Runtime.cs

@ -38,9 +38,7 @@ namespace ICSharpCode.Core
public Assembly LoadedAssembly { public Assembly LoadedAssembly {
get { get {
if (!isAssemblyLoaded) { if (!isAssemblyLoaded) {
#if DEBUG LoggingService.Info("Loading addin " + assembly);
Console.WriteLine("Loading addin " + assembly + "...");
#endif
isAssemblyLoaded = true; isAssemblyLoaded = true;

4
src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.Core
codons[indexOfName[before]].InsertAfter = after + ',' + codons[i].Id; codons[indexOfName[before]].InsertAfter = after + ',' + codons[i].Id;
} }
} else { } else {
Console.WriteLine("Codon ({0}) specified in the insertbefore of the {1} codon does not exist!", before, codons[i]); LoggingService.WarnFormatted("Codon ({0}) specified in the insertbefore of the {1} codon does not exist!", before, codons[i]);
} }
} }
} }
@ -119,7 +119,7 @@ namespace ICSharpCode.Core
if (indexOfName.ContainsKey(s)) { if (indexOfName.ContainsKey(s)) {
Visit(indexOfName[s]); Visit(indexOfName[s]);
} else { } else {
Console.WriteLine("Codon ({0}) specified in the insertafter of the {1} codon does not exist!", codons[codonIndex].InsertAfter, codons[codonIndex]); LoggingService.WarnFormatted("Codon ({0}) specified in the insertafter of the {1} codon does not exist!", codons[codonIndex].InsertAfter, codons[codonIndex]);
} }
} }
sortedCodons.Add(codons[codonIndex]); sortedCodons.Add(codons[codonIndex]);

120
src/Main/Core/Project/Src/Services/LoggingService/LoggingService.cs

@ -0,0 +1,120 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using log4net;
using log4net.Core;
using log4net.Config;
namespace ICSharpCode.Core
{
public static class LoggingService
{
static readonly ILog log = LogManager.GetLogger(typeof(LoggingService));
static LoggingService()
{
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));
}
public static void Debug(object message)
{
log.Debug(message);
}
public static void DebugFormatted(string format, params object[] args)
{
log.DebugFormat(format, args);
}
public static void Info(object message)
{
log.Info(message);
}
public static void InfoFormatted(string format, params object[] args)
{
log.InfoFormat(format, args);
}
public static void Warn(object message)
{
log.Warn(message);
}
public static void Warn(object message, Exception exception)
{
log.Warn(message, exception);
}
public static void WarnFormatted(string format, params object[] args)
{
log.WarnFormat(format, args);
}
public static void Error(object message)
{
log.Error(message);
}
public static void Error(object message, Exception exception)
{
log.Error(message, exception);
}
public static void ErrorFormatted(string format, params object[] args)
{
log.ErrorFormat(format, args);
}
public static void Fatal(object message)
{
log.Fatal(message);
}
public static void Fatal(object message, Exception exception)
{
log.Fatal(message, exception);
}
public static void FatalFormatted(string format, params object[] args)
{
log.FatalFormat(format, args);
}
public static bool IsDebugEnabled {
get {
return log.IsDebugEnabled;
}
}
public static bool IsInfoEnabled {
get {
return log.IsInfoEnabled;
}
}
public static bool IsWarnEnabled {
get {
return log.IsWarnEnabled;
}
}
public static bool IsErrorEnabled {
get {
return log.IsErrorEnabled;
}
}
public static bool IsFatalEnabled {
get {
return log.IsFatalEnabled;
}
}
}
}

23
src/Main/Core/Project/Src/Services/MessageService/MessageService.cs

@ -62,17 +62,18 @@ namespace ICSharpCode.Core
public static void ShowError(Exception ex, string message) public static void ShowError(Exception ex, string message)
{ {
if (customErrorReporter != null && ex != null) { if (ex != null) {
customErrorReporter(ex, message); LoggingService.Error(message, ex);
return; if (customErrorReporter != null) {
customErrorReporter(ex, message);
return;
}
} else {
LoggingService.Error(message);
} }
#if DEBUG #if DEBUG
Console.WriteLine();
if (message != null)
Console.WriteLine(message);
if (ex != null) { if (ex != null) {
Console.WriteLine(ex);
Console.Beep(); Console.Beep();
return; return;
} }
@ -96,7 +97,9 @@ namespace ICSharpCode.Core
public static void ShowWarning(string message) public static void ShowWarning(string message)
{ {
MessageBox.Show(MessageService.MainForm, StringParser.Parse(message), StringParser.Parse("${res:Global.WarningText}"), MessageBoxButtons.OK, MessageBoxIcon.Warning); message = StringParser.Parse(message);
LoggingService.Warn(message);
MessageBox.Show(MessageService.MainForm, message, StringParser.Parse("${res:Global.WarningText}"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
public static void ShowWarningFormatted(string formatstring, params string[] formatitems) public static void ShowWarningFormatted(string formatstring, params string[] formatitems)
@ -162,7 +165,9 @@ namespace ICSharpCode.Core
public static void ShowMessage(string message, string caption) public static void ShowMessage(string message, string caption)
{ {
MessageBox.Show(mainForm, StringParser.Parse(message), StringParser.Parse(caption), MessageBoxButtons.OK, MessageBoxIcon.Information); message = StringParser.Parse(message);
LoggingService.Info(message);
MessageBox.Show(mainForm, message, StringParser.Parse(caption), MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
static string Format(string formatstring, string[] formatitems) static string Format(string formatstring, string[] formatitems)

35
src/Main/StartUp/Project/SharpDevelop.exe.config

@ -1,4 +1,7 @@
<configuration> <configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
@ -19,4 +22,36 @@
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<log4net>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<mapping>
<level value="FATAL" />
<foreColor value="Red, HighIntensity" />
</mapping>
<mapping>
<level value="ERROR" />
<foreColor value="Red" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="White" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="Green" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level- %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="ColoredConsoleAppender" />
</root>
</log4net>
</configuration> </configuration>

125
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -41,6 +41,7 @@ namespace ICSharpCode.SharpDevelop
static void ShowErrorBox(object sender, ThreadExceptionEventArgs eargs) static void ShowErrorBox(object sender, ThreadExceptionEventArgs eargs)
{ {
LoggingService.Error("ThreadException caught", eargs.Exception);
ShowErrorBox(eargs.Exception, null); ShowErrorBox(eargs.Exception, null);
} }
@ -55,54 +56,45 @@ namespace ICSharpCode.SharpDevelop
} }
} }
readonly static string[] assemblyList = {
"Microsoft.VisualBasic.dll",
"Microsoft.JScript.dll",
"mscorlib.dll",
"System.Data.dll",
"System.Design.dll",
"System.DirectoryServices.dll",
"System.Drawing.Design.dll",
"System.Drawing.dll",
"System.EnterpriseServices.dll",
"System.Management.dll",
"System.Messaging.dll",
"System.Runtime.Remoting.dll",
"System.Runtime.Serialization.Formatters.Soap.dll",
"System.Security.dll",
"System.ServiceProcess.dll",
"System.Web.Services.dll",
"System.Web.dll",
"System.Windows.Forms.dll",
"System.dll",
"System.XML.dll"
};
/// <summary> /// <summary>
/// Starts the core of SharpDevelop. /// Starts the core of SharpDevelop.
/// </summary> /// </summary>
[STAThread()] [STAThread()]
public static void Main(string[] args) public static void Main(string[] args)
{ {
#if DEBUG
if (Debugger.IsAttached) { if (Debugger.IsAttached) {
Run(args); Run(args);
} else { return;
try { }
Run(args); #endif
} catch (Exception ex) { // Do not use LoggingService here (see comment in Run(string[]))
Console.WriteLine(ex); try {
try { Run(args);
Application.Run(new ExceptionBox(ex, "Unhandled exception terminated SharpDevelop")); } catch (Exception ex) {
} catch { HandleMainException(ex);
MessageBox.Show(ex.ToString(), "Critical error (cannot use ExceptionBox)"); }
} }
}
static void HandleMainException(Exception ex)
{
LoggingService.Fatal(ex);
try {
Application.Run(new ExceptionBox(ex, "Unhandled exception terminated SharpDevelop"));
} catch {
MessageBox.Show(ex.ToString(), "Critical error (cannot use ExceptionBox)");
} }
} }
static void Run(string[] args) static void Run(string[] args)
{ {
// DO NOT USE LoggingService HERE!
// LoggingService requires ICSharpCode.Core.dll and log4net.dll
// When a method containing a call to LoggingService is JITted, the
// libraries are loaded.
// We want to show the SplashScreen while those libraries are loaded, so
// don't call LoggingService.
#if DEBUG #if DEBUG
Control.CheckForIllegalCrossThreadCalls = true; Control.CheckForIllegalCrossThreadCalls = true;
#endif #endif
@ -133,18 +125,36 @@ namespace ICSharpCode.SharpDevelop
static void RunApplication() static void RunApplication()
{ {
if (!Debugger.IsAttached) { LoggingService.Info("Starting SharpDevelop...");
Application.ThreadException += ShowErrorBox; try {
if (!Debugger.IsAttached) {
Application.ThreadException += ShowErrorBox;
}
#if !DEBUG
MessageService.CustomErrorReporter = ShowErrorBox;
#endif
RegisterDoozers();
InitializeCore();
// finally start the workbench.
try {
LoggingService.Info("Starting workbench...");
new StartWorkbenchCommand().Run(SplashScreenForm.GetRequestedFileList());
} finally {
LoggingService.Info("Unloading services...");
ProjectService.CloseSolution();
FileService.Unload();
PropertyService.Save();
}
} finally {
LoggingService.Info("Leaving RunApplication()");
} }
#if !DEBUG }
MessageService.CustomErrorReporter = ShowErrorBox;
#endif static void RegisterDoozers()
{
// TODO:
// bool ignoreDefaultPath = false;
// string [] addInDirs = ICSharpCode.SharpDevelop.AddInSettingsHandler.GetAddInDirectories(out ignoreDefaultPath);
// SetAddInDirectories(addInDirs, ignoreDefaultPath);
AddInTree.ConditionEvaluators.Add("ActiveContentExtension", new ActiveContentExtensionConditionEvaluator()); AddInTree.ConditionEvaluators.Add("ActiveContentExtension", new ActiveContentExtensionConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ActiveViewContentUntitled", new ActiveViewContentUntitledConditionEvaluator()); AddInTree.ConditionEvaluators.Add("ActiveViewContentUntitled", new ActiveViewContentUntitledConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ActiveWindowState", new ActiveWindowStateConditionEvaluator()); AddInTree.ConditionEvaluators.Add("ActiveWindowState", new ActiveWindowStateConditionEvaluator());
@ -171,43 +181,38 @@ namespace ICSharpCode.SharpDevelop
AddInTree.Doozers.Add("Debugger", new DebuggerDoozer()); AddInTree.Doozers.Add("Debugger", new DebuggerDoozer());
MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); }; MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); };
}
static void InitializeCore()
{
LoggingService.Info("Loading properties...");
PropertyService.Load(); PropertyService.Load();
StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider()); StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
LoggingService.Info("Loading AddInTree...");
AddInTree.Load(); AddInTree.Load();
LoggingService.Info("Initializing workbench...");
// .NET base autostarts // .NET base autostarts
// taken out of the add-in tree for performance reasons (every tick in startup counts) // taken out of the add-in tree for performance reasons (every tick in startup counts)
new InitializeWorkbenchCommand().Run(); new InitializeWorkbenchCommand().Run();
// run workspace autostart commands // run workspace autostart commands
try { try {
LoggingService.Info("Running autostart commands...");
foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) { foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) {
command.Run(); command.Run();
} }
} catch (XmlException e) { } catch (XmlException e) {
LoggingService.Error("Could not load XML", e);
MessageBox.Show("Could not load XML :" + Environment.NewLine + e.Message); MessageBox.Show("Could not load XML :" + Environment.NewLine + e.Message);
return; return;
} catch (Exception e) {
MessageBox.Show("Loading error, please reinstall :" + Environment.NewLine + e.ToString());
return;
} finally { } finally {
if (SplashScreenForm.SplashScreen != null) { if (SplashScreenForm.SplashScreen != null) {
SplashScreenForm.SplashScreen.Dispose(); SplashScreenForm.SplashScreen.Dispose();
} }
} }
// finally start the workbench.
try {
new StartWorkbenchCommand().Run(SplashScreenForm.GetRequestedFileList());
} finally {
// unloading
ProjectService.CloseSolution();
FileService.Unload();
PropertyService.Save();
}
} }
} }
} }

Loading…
Cancel
Save