• 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 contacted 0patch and I'm trying to work with it, this is new to me, but I'll figure it before EOL and then get a 5 year patches for € 125. My acer laptop is 6 years old but still going strong, I can maintain it myself; with the help of IFixit, Acer Aspire 7 fully loaded
    • Since win 95 I never used system sound; only the first time to check if the sound card works; after that no annoying click sounds and whistles on every key stroke or every notification. That's why I have my taskbar on top, you'll notice the notification center way sooner at the top right than at the bottom right.
    • 6000MT/s is the sweet spot for DDR5, so then you would be thinking about cache latency, and again CL30 (or lower) is great but don't take my word for it here is a guide I used on my own system with 64GB Kingston Fury CL36 6000 now running at CL30 https://www.patreon.com/posts/low-effort-rank-77403831
    • Here is a list of Samsung Galaxy watches that won't be supported after September 2025 by Sayan Sen Samsung Gear S3 Samsung has confirmed that support for its Tizen-powered smartwatches will officially end in September 2025. The decision marks the final phase of a gradual wind-down process that began last year and reflects the company’s strategic shift toward its Wear OS–powered devices from its own in-house Tizen. If you recall, the South Korean giant began moving away from it back in 2021. The phase-out started on September 30, 2024, when the Galaxy Store stopped offering paid content for Tizen devices. This was followed by another key deadline on May 31, 2025, when new downloads of free Tizen content were disabled. Finally, by the end of September 2025 later this year, users will no longer be able to re-download any previously purchased content via the Galaxy Store. At the time, Samsung had shared the following timeline in an official "Tizen Watch Service Termination Schedule" notice as it wrote: While Samsung has not specified the list of affected wearable devices that will no longer receive Tizen support after September 2025, the following products are likely to be getting the axe: Galaxy Gear Series Samsung Galaxy Gear (Original model) Samsung Galaxy Gear 2 Samsung Galaxy Gear S2 Samsung Gear S3 Classic Samsung Gear S3 Frontier Galaxy Watch Series (Tizen-based) Samsung Galaxy Watch (First Generation / Galaxy Watch 1) Samsung Galaxy Watch Active Samsung Galaxy Watch Active2 Samsung Galaxy Watch 3 Thus, devices launched after the Galaxy Watch3, including the Galaxy Watch4 series and subsequent models, are built on Wear OS and remain unaffected by this transition. On the flip side, Samsung is not planning to switch to Google TV for its TVs, as these still come preloaded with its own Tizen OS, and even offer seven years of support.
    • If I'm not mistaken, doesn't almost al servers run apache, wich is linux
  • Recent Achievements

    • One Month Later
      jezzzy earned a badge
      One Month Later
    • First Post
      CSpera earned a badge
      First Post
    • One Month Later
      MIR JOHNNY BLAZE earned a badge
      One Month Later
    • Apprentice
      Wireless wookie went up a rank
      Apprentice
    • Week One Done
      bukro earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      628
    2. 2
      ATLien_0
      282
    3. 3
      +FloatingFatMan
      180
    4. 4
      Michael Scrip
      150
    5. 5
      Steven P.
      119
  • Tell a friend

    Love Neowin? Tell a friend!