icsharpcode / SharpDevelop

#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
2.09k stars 776 forks source link

Switch to design view throws exception #717

Open defenderjim opened 9 years ago

defenderjim commented 9 years ago

When switching from code view to design view, SharpDevelop fails. I get this error:

Failed to load designer. Check the source code for syntax errors and check if all references are available.

System.ArgumentNullException: Value cannot be null. Parameter name: attributeType at ICSharpCode.NRefactory.TypeSystem.TypeSystemExtensions.GetAttributes(IEntity entity, IType attributeType, Boolean inherit) at ICSharpCode.FormsDesigner.Gui.CustomComponentsSideTab.ScanProjectAssemblies() at ICSharpCode.FormsDesigner.Gui.CustomComponentsSideTab..ctor(SideBarControl sideTab, String name, IToolboxService toolboxService) at ICSharpCode.FormsDesigner.ToolboxProvider.ReloadSideTabs(Boolean doInsert) at ICSharpCode.FormsDesigner.ToolboxProvider.CreateToolboxService() at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadDesigner() at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadAndDisplayDesigner() at ICSharpCode.FormsDesigner.FormsDesignerViewContent.LoadInternal(OpenedFile file, Stream stream) at ICSharpCode.SharpDevelop.Workbench.AbstractViewContentHandlingLoadErrors.Load(OpenedFile file, Stream stream)

defenderjim commented 8 years ago

This is caused when opening a project created by VS 2015 Express in SharpDevelop. I think the resX is not compatible. Can't confirm because I can't build because it won't find resgen.exe

linquize commented 8 years ago

Could you post your source code here?

linquize commented 8 years ago

.net version of the project? .net 4.6?

defenderjim commented 8 years ago

Unfortunately, as of yesterday, I am unable to reproduce this issue. SD crashed yesterday and would not re-open the solution file. I had to recreate the solution from scratch. Once I did that, SD started working and this problem went away. I am running Win 7 64. I created a new project in VS Express 2015 and re-opened in SD. No crash. I do have .Net 4.6 installed, however VS says it is loading .Net 4.5 components.

subchannel13 commented 8 years ago

I'm seeing the same error message in project exclusively developed with SharpDevelop. I added an image to a resource file, added the image to button and changed a code in custom control. Can't open form designer for that particular form (with new button and custom control) while everything works fine in the run-time.

SD version: SharpDevelop Version : 5.1.0.4936-Beta-3ea20cfa .NET Version : 4.6.00081 OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1 Current culture : Croatian (Croatia) (hr-HR) Current UI language : en Running under WOW6432, processor architecture: x86-64 Working Set Memory : 235176kb GC Heap Memory : 80509kb

defenderjim commented 8 years ago

All I can add is that I originally created the project w/Visual Studio Express 2015. Then at moved over to SD. That's when the problem occurred.

subchannel13 commented 8 years ago

OK, here is a crazy thing that fixed my problem:

I've opened a solution in Visual Studio 2010 to see if there are some setting I can change, for some reason I was suspecting localization issue. While inspecting Resources tab in the project properties I've noticed exclamation mark in red circle next to one image resource. Mousing over gave following message: "The resource name 'goto' is not a valid identifier.".

Renaming "goto" to "gotoArrow" fixed SharpDevelop designer error on all forms which where using something from a resource file.

I can't find an official document with invalid resource names, there is something about avoiding having spaces because they are replaced with underscores. Considering the fact that resource name is internally used as C# property name, the name should not be a C# keyword or any other illegal property name.