From 1fabc19dbd187b5bf50e11ebbee4350d8d21b952 Mon Sep 17 00:00:00 2001 From: Christian Hornung Date: Mon, 23 Oct 2006 18:44:55 +0000 Subject: [PATCH] Fixed SD2-1107: InvalidEnumArgumentException when making form localizable and text alignment set to TopRight. Do not create a new instance of DesignerResourceService on every designer load because this service caches the resource contents. Otherwise any changes to the resources are discarded when the user switches between source and design view more than once without saving. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1933 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../FormsDesigner/Project/Src/DesignerViewContent.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs index adcf5d8802..ca0f859d4a 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs @@ -111,7 +111,14 @@ namespace ICSharpCode.FormsDesigner serviceContainer.AddService(typeof(IHelpService), new HelpService()); serviceContainer.AddService(typeof(System.Drawing.Design.IPropertyValueUIService), new PropertyValueUIService()); - designerResourceService = new DesignerResourceService(viewContent.FileName); + // Do not re-initialize the resource service on every load + // because of SD2-1107. + // The service holds cached resource file contents which + // may not have been written to disk yet if the user switched + // between source and design view without saving. + if (designerResourceService == null) { + designerResourceService = new DesignerResourceService(viewContent.FileName); + } serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), designerResourceService); AmbientProperties ambientProperties = new AmbientProperties(); serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);