Search code examples
c#sharpdevelopoxyplot

sharpdevelop Failed to load designer


I'm using Sharpdevelop 5.1.0.5134 with .NET 4.5.51209 to make desktop application based on Windows.Forms

At first, everything was fine, no warnings and the designer shows the form correctly and I can easily add components.

After that I added OxyPlot correctly from the Package Management Console and I found the new PlotView component in the Custom Comonents tab.

The problem is that I can't add the component to the Form from the tools tab, so I did it by writing the equivalents statements in the source file.

The building process went fine and the application worked fine, but now I can't see the Form in the designer tab and instead I got this message:

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

ICSharpCode.FormsDesigner.FormsDesignerLoadException: System.ComponentModel.Design.Serialization.CodeDomSerializerException: Could not find type 'OxyPlot.WindowsForms.PlotView'.  Please make sure that the assembly that contains this type is referenced.  If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.

System.ComponentModel.Design.Serialization.CodeDomSerializerException: The variable 'plot1' is either undeclared or was never assigned.
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
   at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


   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)

How can I solve this problem?


Solution

  • It looks like a bug in SharpDevelop 5.1 being unable to resolve the OxyPlot assemblies.

    It looks like SharpDevelop 4.4 does not have the same problem and can open the form in the designer.

    As a workaround for SharpDevelop 5.1 you can copy the OxyPlot.dll and OxyPlot.WindowsForms.dll files into C:\Program Files (x86)\SharpDevelop\5.1\bin

    Then restart SharpDevelop and then you can open the form in the designer without any errors.

    This bug should be fixed in SharpDevelop 5.1.0.5173 and above.