Forum  General Visual ...  Install It!  Value cannot be null. Parameter name: instance
Previous Previous
 
Next Next
New Post 10/30/2010 7:11 AM
  slink9
39 posts
No Ranking


Value cannot be null. Parameter name: instance 

Help. I get this error with every form that I try to view. I am using Visual Studio 2008 Pro version 9.0.30729.1 SP and the code is in Visual C# 91605-140-003683-60057 .NET framework is 3.5 SP1 VWG Professional Studio 1.1 build 6.3.13 Win7

This is a program that I have inherited from another programmer to maintain and update but I can't view the forms in the editor. Is something misconfigured in my VWG setup? Is there something additional that I should install?

 
New Post 10/30/2010 7:27 AM
  palli
11824 posts
1st Level Poster




Re: Value cannot be null. Parameter name: instance 

Hi slink,

This error is very similar to errors you get when opening ASP.NET wrapped controls in the designer. This can also happen when you load forms or usercontrols that have some initialization code in their constructor or load event handler, that should not be run while designing.

Remarkably enough, Visual Studio form designers (Visual WebGui included) do fire the Load event of loaded UserControls while designing, and of course they "fire" the constructor. You should move from the constructor to the Load event handler any code that is not vital to have in the constructor, and within the Load event handler you should enclose the codeblock within "If Not DesignMode" so it will not run within the designer.

Those are some of the general issues to watch out for, and not much more I can do without seeing some code.

You are welcome to clean and zip your project and email it to the support email address (see my signature) for us to taka a look. If you choose to do so, please include the full Http reference to this thread so we can pair your email with the thread, and also please post here when you have sent it so we know when to look for your email.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 10/30/2010 8:10 AM
  slink9
39 posts
No Ranking


Re: Value cannot be null. Parameter name: instance 

I can't see what to move and where it is. If I do a search in the entire project for "instance" nothing related seems to show up.

The call stack is

at System.ComponentModel.TypeDescriptor.AddAttributes(Object instance, Attribute[] attributes)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponent component, Boolean rootDesigner)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)

and the designer code is

 

 namespace SES.Investigator.Modules
{
    partial class MasterTableList
    {
        /// <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);
        }

        #region Visual WebGui UserControl Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Gizmox.WebGUI.Common.Resources.IconResourceHandle iconResourceHandle1 = new Gizmox.WebGUI.Common.Resources.IconResourceHandle();
            Gizmox.WebGUI.Common.Resources.IconResourceHandle iconResourceHandle2 = new Gizmox.WebGUI.Common.Resources.IconResourceHandle();
            Gizmox.WebGUI.Common.Resources.IconResourceHandle iconResourceHandle3 = new Gizmox.WebGUI.Common.Resources.IconResourceHandle();
            this.lbxList = new Gizmox.WebGUI.Forms.ListBox();
            this.splitter1 = new Gizmox.WebGUI.Forms.Splitter();
            this.dataGridView1 = new Gizmox.WebGUI.Forms.DataGridView();
            this.contextMenu1 = new Gizmox.WebGUI.Forms.ContextMenu();
            this.btnAddItem = new Gizmox.WebGUI.Forms.MenuItem();
            this.btnEditItem = new Gizmox.WebGUI.Forms.MenuItem();
            this.btnDeleteItem = new Gizmox.WebGUI.Forms.MenuItem();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // lbxList
            //
            this.lbxList.Anchor = Gizmox.WebGUI.Forms.AnchorStyles.None;
            this.lbxList.BorderStyle = Gizmox.WebGUI.Forms.BorderStyle.Fixed3D;
            this.lbxList.Dock = Gizmox.WebGUI.Forms.DockStyle.Left;
            this.lbxList.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.lbxList.Location = new System.Drawing.Point(0, 0);
            this.lbxList.Name = "lbxList";
            this.lbxList.SelectionMode = Gizmox.WebGUI.Forms.SelectionMode.MultiSimple;
            this.lbxList.Size = new System.Drawing.Size(181, 615);
            this.lbxList.TabIndex = 0;
            this.lbxList.Click += new System.EventHandler(this.lbxList_Click);
            //
            // splitter1
            //
            this.splitter1.Anchor = Gizmox.WebGUI.Forms.AnchorStyles.None;
            this.splitter1.Dock = Gizmox.WebGUI.Forms.DockStyle.Left;
            this.splitter1.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.splitter1.Location = new System.Drawing.Point(181, 0);
            this.splitter1.Name = "splitter1";
            this.splitter1.Size = new System.Drawing.Size(3, 624);
            this.splitter1.TabIndex = 1;
            //
            // dataGridView1
            //
            this.dataGridView1.Anchor = Gizmox.WebGUI.Forms.AnchorStyles.None;
            this.dataGridView1.ContextMenu = this.contextMenu1;
            this.dataGridView1.Dock = Gizmox.WebGUI.Forms.DockStyle.Fill;
            this.dataGridView1.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.dataGridView1.Location = new System.Drawing.Point(184, 0);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ReadOnly = true;
            this.dataGridView1.Size = new System.Drawing.Size(583, 624);
            this.dataGridView1.TabIndex = 2;
            this.dataGridView1.UseInternalPaging = false;
            this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
            this.dataGridView1.CellDoubleClick += new Gizmox.WebGUI.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
            this.dataGridView1.MenuClick += new Gizmox.WebGUI.Forms.MenuEventHandler(this.dataGridView1_MenuClick);
            //
            // contextMenu1
            //
            this.contextMenu1.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.contextMenu1.MenuItems.AddRange(new Gizmox.WebGUI.Forms.MenuItem[] {
            this.btnAddItem,
            this.btnEditItem,
            this.btnDeleteItem});
            //
            // btnAddItem
            //
            this.btnAddItem.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            iconResourceHandle1.File = "document_add.png";
            this.btnAddItem.Icon = iconResourceHandle1;
            this.btnAddItem.Tag = "Add";
            this.btnAddItem.Text = "Add Item";
            //
            // btnEditItem
            //
            this.btnEditItem.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.btnEditItem.Enabled = false;
            iconResourceHandle2.File = "document_edit.png";
            this.btnEditItem.Icon = iconResourceHandle2;
            this.btnEditItem.Tag = "Edit";
            this.btnEditItem.Text = "Edit";
            //
            // btnDeleteItem
            //
            this.btnDeleteItem.DragTargets = new Gizmox.WebGUI.Forms.Component[0];
            this.btnDeleteItem.Enabled = false;
            iconResourceHandle3.File = "document_delete.png";
            this.btnDeleteItem.Icon = iconResourceHandle3;
            this.btnDeleteItem.Tag = "Delete";
            this.btnDeleteItem.Text = "Delete";
            //
            // MasterTableList
            //
            this.Controls.Add(this.dataGridView1);
            this.Controls.Add(this.splitter1);
            this.Controls.Add(this.lbxList);
            this.Size = new System.Drawing.Size(767, 644);
            this.Text = "MasterTableList";
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private Gizmox.WebGUI.Forms.ListBox lbxList;
        private Gizmox.WebGUI.Forms.Splitter splitter1;
        private Gizmox.WebGUI.Forms.DataGridView dataGridView1;
        private Gizmox.WebGUI.Forms.ContextMenu contextMenu1;
        private Gizmox.WebGUI.Forms.MenuItem btnAddItem;
        private Gizmox.WebGUI.Forms.MenuItem btnEditItem;
        private Gizmox.WebGUI.Forms.MenuItem btnDeleteItem;


    }
}

 
New Post 10/30/2010 10:10 AM
  slink9
39 posts
No Ranking


Re: Value cannot be null. Parameter name: instance 

I believe that I have found the solution - uninstall VWG and reinstall for .NET2. That seems to have worked well for me. Thanks.

 
New Post 10/30/2010 10:24 AM
  palli
11824 posts
1st Level Poster




Re: Value cannot be null. Parameter name: instance 

Hi slink,

Glad you found your solution, and yes, if you are using Visual Studio 2005, this would be correct. Visual WebGui NET 2.0 is for Visual Studio 2005, NET 3.5 is for Visual Studio 2008 and NET 4.0 is for Visual Studio 2010.

Thanks for the confirmation,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  Install It!  Value cannot be null. Parameter name: instance
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS