• 0

[VS2008] The designer loader did not provide a root component but...


Question

I have this application that's working perfectly fine, I mean, I can compile without any errors/warnings/whatever and run it just like any other and it just works.

However, every time I do (compile), the main form designer just disappears and instead I get the following:

vs2008bugrk2.th.jpg

I've searched Google a lot and found various links about it but couldn't find a way to solve it...

This is driving me nuts, every time it happens, I have to close the form and reopen and it's becoming very annoying...

Any ideas?

EDIT:

Something I forgot... I'm not sure if this is really the cause or not but, the main form inherits from a class named SkinnedForm and the problem I just described happens basically when the main form inherits from SkinnedForm. If I change the inheritance to the default (Form), it doesn't happen any more.

So, here's the whole SkinnedForm class:

http://paste.portugal-a-programar.org/pastebin.php?show=2266

Do you think there's something wrong with it?

Edited by Nazgulled

8 answers to this question

Recommended Posts

  • 0
  Nazgulled said:
Nobody can help me out?

Seeing how no stack trace is available and that you use native methods inside WndProc the error is likely due to Unmanaged code. Try making the WndProc code for runtime only by using the IsDesignMode property:

protected override void WndProc(ref Message m) 
{
  if(!IsDesignMode)
  {
	  //all the code here
  }
}

If that doesn't fix it, try it on every piece of code in the SkinnedForm class until you locate the problem.

  • 0

Actually it's just DesignMode but I don't think it's working. I put that on every piece of code in the SkinnedForm class but it didn't help...

Anyway, that "if(!DesignMode)" suggestion actually makes sense, do you think I should keep it anyways? But I should have the "base.WndProc(ref m);" outside the if right?

  • 0
  Nazgulled said:
Actually it's just DesignMode but I don't think it's working. I put that on every piece of code in the SkinnedForm class but it didn't help...

Anyway, that "if(!DesignMode)" suggestion actually makes sense, do you think I should keep it anyways? But I should have the "base.WndProc(ref m);" outside the if right?

I'm not even sure WndProc gets called in design mode, so it might be unnecessary. But if it does, then yes, base.WndProc should be outside the if statement.

  • 0
  Nazgulled said:
I have this application that's working perfectly fine, I mean, I can compile without any errors/warnings/whatever and run it just like any other and it just works.

However, every time I do (compile), the main form designer just disappears and instead I get the following:

vs2008bugrk2.th.jpg

I've searched Google a lot and found various links about it but couldn't find a way to solve it...

This is driving me nuts, every time it happens, I have to close the form and reopen and it's becoming very annoying...

Any ideas?

EDIT:

Something I forgot... I'm not sure if this is really the cause or not but, the main form inherits from a class named SkinnedForm and the problem I just described happens basically when the main form inherits from SkinnedForm. If I change the inheritance to the default (Form), it doesn't happen any more.

So, here's the whole SkinnedForm class:

http://paste.portugal-a-programar.org/pastebin.php?show=2266

Do you think there's something wrong with it?

If you have not solved the problem,

The problem as far as I can see is in the initialization of the components in form X.designer.cs

I have, and many others have had the same issue and I discovered that the order in which the components are initialized will cause this problem.

for example, a data grid component may be dependent on some other component such as a binding source, if the initialization order of the binding source is after the data grid it may! cause this problem.

This was certainly the case for the issue I had, in my case, I had a custom data grid derived from a standard grid with additional properties, a custom control which was also dependent on another custom control.

One of the custom properties of the data grid triggered the initialization for first (very dependent) custom control which was not yet initialized (null), to make matters worse the first custom control needed to have its reference to the second (very dependent) custom control set before the data grid could be successfully initialized.

The solution was simple, move the initialization code for the vital components to before the initialization of the component which is causing the problem.

As the initialization order of the second custom control was before the first custom control and the data grid, this did not need to be moved, however the first controls initialization code needed to be moved to before the initialization code of the data grid.

// Before -----------------------------------------------------------------------------------------------------------------

//

// data grid

//

this.gvWidgets.AltRowColor = System.Drawing.Color.Empty;

this.gvWidgets.ColWidths = null;

this.gvWidgets.Connect = true; --------> this line triggered the initialization of the first custom control.

this.gvWidgets.ControlLabel = null;

this.gvWidgets.DefaultRowColor = System.Drawing.Color.Empty;

this.gvWidgets.FieldList = "description,price,stock";

this.gvWidgets.FillControl = false;

this.gvWidgets.Location = new System.Drawing.Point(6, 59);

this.gvWidgets.LookUpFields = null;

this.gvWidgets.Name = "gvWidgets";

this.gvWidgets.OrderByPart = null;

this.gvWidgets.PrettyName = "Widgets";

this.gvWidgets.RecordIdFieldName = "id";

this.gvWidgets.SelectedRow = 0;

this.gvWidgets.Size = new System.Drawing.Size(463, 150);

this.gvWidgets.SqlDataSource = this.sqWGrid; ----------> this is the first custom control not yet initialized

this.gvWidgets.SwitchRowColors = false; this needed to be moved to above the line that triggered

this.gvWidgets.TabIndex = 0; the initialization

this.gvWidgets.TableName = "widget";

this.gvWidgets.TotalFields = null;

this.gvWidgets.TotalsRowColor = System.Drawing.Color.Empty;

this.gvWidgets.WantRecordId = false;

this.gvWidgets.WherePart = "";

//

// first custom control

//

this.sqWGrid.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("sqWGrid.BackgroundImage

this.sqWGrid.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;

this.sqWGrid.Location = new System.Drawing.Point(86, 278);

this.sqWGrid.Name = "sqWGrid";

this.sqWGrid.ServerSource = this.Server;

this.sqWGrid.Size = new System.Drawing.Size(20, 22);

this.sqWGrid.sqlConnect = true;

this.sqWGrid.SqlStatement = "SELECT description,price,stock FROM widget";

this.sqWGrid.TabIndex = 49;

this.sqWGrid.Text = "lizardSQLSource1";

this.sqWGrid.Visible = false;

// After --------------------------------------------------------------------------------------------------------------------

//

// first custom control

//

this.sqWGrid.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("sqWGrid.BackgroundImage

this.sqWGrid.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;

this.sqWGrid.Location = new System.Drawing.Point(86, 278);

this.sqWGrid.Name = "sqWGrid";

this.sqWGrid.ServerSource = this.Server;

this.sqWGrid.Size = new System.Drawing.Size(20, 22);

this.sqWGrid.sqlConnect = true;

this.sqWGrid.SqlStatement = "SELECT description,price,stock FROM widget";

this.sqWGrid.TabIndex = 49;

this.sqWGrid.Text = "lizardSQLSource1";

this.sqWGrid.Visible = false;

//

// data grid

//

this.gvWidgets.AltRowColor = System.Drawing.Color.Empty;

this.gvWidgets.ColWidths = null;

this.gvWidgets.SqlDataSource = this.sqWGrid;

this.gvWidgets.Connect = true;

this.gvWidgets.ControlLabel = null;

this.gvWidgets.DefaultRowColor = System.Drawing.Color.Empty;

this.gvWidgets.FieldList = "description,price,stock";

this.gvWidgets.FillControl = false;

this.gvWidgets.Location = new System.Drawing.Point(6, 59);

this.gvWidgets.LookUpFields = null;

this.gvWidgets.Name = "gvWidgets";

this.gvWidgets.OrderByPart = null;

this.gvWidgets.PrettyName = "Widgets";

this.gvWidgets.RecordIdFieldName = "id";

this.gvWidgets.SelectedRow = 0;

this.gvWidgets.Size = new System.Drawing.Size(463, 150);

this.gvWidgets.SwitchRowColors = false;

this.gvWidgets.TabIndex = 0;

this.gvWidgets.TableName = "widget";

this.gvWidgets.TotalFields = null;

this.gvWidgets.TotalsRowColor = System.Drawing.Color.Empty;

this.gvWidgets.WantRecordId = false;

this.gvWidgets.WherePart = "";

//----------------------------------------------------------------------------------------------------------

I think that Microsoft needs to fix this problem by setting the initialization code in order of a components dependents not in order of which they are placed on a form.

I hope this helps you and others having the same problem.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I had this issue and it is a nova android conflict issue. Initially the only way to fix it was clicking the screen off and then back on. Figured out it was because of a task I set up in tasker to load certain apps when I connect to my car, so fixed it by adding a 'go home' task after the app loaded and rarely have the issue now
    • I wish one of the windows updates hadn't broken glass. Is there a workaround for that I'm not aware of?
    • OpenAI announces o3 Pro, its most intelligent reasoning model by Pradeep Viswanathan OpenAI today announced o3-pro, its flagship reasoning model that uses more compute to "think harder" and provide consistently better answers. This new model will be replacing o1-pro in ChatGPT since it consistently performs better in math, science, and coding. To help everyone make the most out of the model, o3-pro supports tool calling. So, based on the user prompt, the model can do a web search, analyze files, reason about visual inputs, use Python, personalize responses using memory, and more. This is a big improvement over o1-pro, which lacked access to tools. But the downside is that o3-pro will take more time to respond. OpenAI recommends users use o3-pro in cases where reliability matters more than speed. According to OpenAI's evaluations, users consistently preferred o3-pro's responses over o3 in key domains like science, education, programming, business, and writing help. o3-pro was also rated consistently higher for clarity, comprehensiveness, instruction-following, and accuracy. The new o3-pro model is available in ChatGPT's model picker for Pro and Team. ChatGPT's Enterprise and Edu users will get access to this latest model next week. For developers, the o3-pro model comes with a 200,000 context window and is priced at $20 per million input tokens and $80 per million output tokens. OpenAI recommends developers use background mode with o3-pro to prevent timeouts. And the model has a May 31, 2024 knowledge cutoff. The OpenAI team also noted the following as the current limitations of the o3-pro model: At the moment, temporary chats are disabled for o3-pro as we resolve a technical issue. Image generation is not supported within o3-pro—please use GPT-4o, OpenAI o3, or OpenAI o4-mini to generate images. Canvas is also currently not supported within o3-pro. As OpenAI continues to refine its models, the balance between speed and reliability will likely remain a key consideration for users choosing the right tool for their needs.
  • Recent Achievements

    • Reacting Well
      rshit earned a badge
      Reacting Well
    • Reacting Well
      Alan- earned a badge
      Reacting Well
    • Week One Done
      IAMFLUXX earned a badge
      Week One Done
    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      541
    2. 2
      ATLien_0
      269
    3. 3
      +FloatingFatMan
      210
    4. 4
      +Edouard
      203
    5. 5
      snowy owl
      140
  • Tell a friend

    Love Neowin? Tell a friend!