Profile Picture

Object State errors after upgrading

Posted By Jim Rowe 13 Years Ago
Author
Message
Jim Rowe
sad Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 4, Visits: 1
Is there a way to upgrade the components without getting an object state error? Every time we upgrade NevronChart there is an error when the designer tries to read the object state from the resource. This results in us needing to re-create the chart from scratch which is tremendously annoying.

Do they have some sort of project updater, or a process to follow to avoid this? (e.g., DevExpress has such a tool and it works great).

thanks.
--Jim

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Jim,

The problem with the state is that .NET cannot read binary serialized state when the assembly version changes. On the other hand we had to choose from XML or Binary when there is a designer on the form and decided to go with Binary serialization as it is much faster (otherwise the form compiles Ok after a new version is installed, but takes too much time to load). There a couple of workarounds:

1. You can delete the following line from InitializeComponent:

this.nChartControl1.State = ((Nevron.Chart.WinForm.NState)(resources.GetObject("nChartControl1.State")));

and the form will compile when you change the version of the control + it will load much faster.

2. You can create a simple user control that nests the chart:

using System.Windows.Forms;
using Nevron.Chart.WinForm;

namespace WindowsFormsApplication1
{
 public partial class NCustomChartControl : UserControl
 {
  /// <summary>
  /// Required designer variable.
  /// </summary>
  private System.ComponentModel.IContainer components = null;

  /// <summary>
  /// Clean up any resources being used.
  /// </summary>
  /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  protected override void Dispose(bool disposing)
  {
   if (disposing && (components != null))
   {
    components.Dispose();
   }
   base.Dispose(disposing);
  }


  public NCustomChartControl()
  {
   nChartControl1 = new NChartControl();
   nChartControl1.Dock = DockStyle.Fill;
   this.Controls.Add(nChartControl1);
  }

  public Nevron.Chart.WinForm.NChartControl nChartControl1;
 }
}
That way when you insert the control in a form it will not generate code to load / save the state from binary.

Hope this helps - let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic