• 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

    • iPhone 17 Pro Max could have the biggest battery ever on an iPhone by Devesh Beri Leaks around how the iPhone 17 Pro lineup is going to look may have left fans hesitant about what Apple is planning for its next flagship, but not every rumor paints a gloomy picture. In fact, one area where the iPhone 17 Pro Max could truly stand out is its battery; rumors say it is to have the biggest battery ever seen in an iPhone. Let's be honest, battery life has long been a weak point for iPhones. No matter how efficient Apple's A-series chipsets are said to be, users often find their devices running out of juice quicker than expected. Much of the blame could be put on the relatively small battery sizes Apple has chosen over the years, especially when compared to the competition. Many rival brands now give their large-screen devices, those with displays bigger than 6.5 inches, batteries of at least 5000mAh. In contrast, Apple's largest iPhones have lagged behind in this department, with the iPhone 16 Pro Max coming in at 4676mAh. It seems like it is set to change with the iPhone 17 Pro Max, as a prominent leaker, Instant Digital, revealed that the battery of the iPhone 17 Pro Max will finally reach the 5000mAh mark. How big a change would it be? To put it in perspective, the iPhone 17 Pro Max's battery would be about 6.9% bigger than the iPhone 16 Pro Max, 13.1% more than the iPhone 15 Pro Max, and 15.7% more than the iPhone 14 Pro Max. If these rumors are accurate, the iPhone 17 Pro Max may finally address one of the most common complaints about Apple's flagship devices, but then again, Apple would still be lagging as most of the brands, specially the Chinese ones have already moved to the battery limits of 6000mAh and some have even touched 7000mAh. This rumor comes after the observation that Apple's struggles with AI may prompt it to transition Siri to either OpenAI or Anthropic's AI capabilities. Image source: Digit.in
    • Hope they laid off whatever middle managers thought it was a good idea to rebrand AAD as "Microsoft Entra ID" and Yammer as "Viva Engage," costing Microsoft some valuable brand recognition.
    • Microsoft removes PowerShell 2.0 from Windows 11 in build 27891 by Taras Buria Microsoft has released a new Windows 11 preview build from the Canary Channel. Build 27891 is out with several improvements and fixes, a new feature for the Microsoft Store, and the removal of PowerShell 2.0, which is now deprecated. Microsoft deprecated PowerShell 2.0 all the way back in Windows 10 version 1709. Last month, it issued a reminder about it, and now, PowerShell 2.0 is gone from the latest Windows 11 Canary builds. Microsoft says it will publish more information about PowerShell 2.0 removal in the upcoming update for Windows 11. Also, Microsoft is rolling out a new update for the Microsoft Store. Version 22406 is rolling out to Windows Insiders in the Canary and Dev Channels, offering the ability to install a product right from the Store's home page, as seen in the screenshot below: Here is what was fixed: [General] We fixed the issue causing the “Reset this PC” option under Settings > System > Recovery to not work after upgrading the last few Canary Channel builds. Fixed the underlying issue which was causing the taskbar to unexpectedly not showing acrylic material after upgrading to the latest Canary builds. This also impacted a few other scenarios, leading to unexpected black or white in some UI. Fixed an underlying issue believed to be the cause of some Insiders seeing Windows update downloads to get stuck at 2% recently. Fixed a few more languages including Vietnamese and Arabic that were still having issues with certain characters not rendering correctly for Insiders after the latest builds, causing nonsense to display in places like Task Manager and more. This impacted characters outside of A-Z. [File Explorer] Fixed an issue where if you opened the “…” menu in the File Explorer address bar to show the full list of folders for the current path, the dropdown might be cut off and the bottom of it inaccessible. [Settings] Fixed an issue in the previous build which could cause Settings to crash when opening microphone properties under Settings > System > Sound. Fixed an underlying issue related to Bluetooth which could cause Settings or Quick Settings to crash on launch for some people. [Windowing] Fixed an issue which was causing the window minimizing animation to not display correctly in the previous flight. [Task Manager] Fixed an issue where the CPU graphs in the Performance page were still using the old CPU utility calculations. Fixed an issue where after adding the new CPU Utility column, you might notice that System Idle Process always showed as 0. [Audio] Fixed an issue which could cause all system sounds to stop working (for example notification alert sound and the sound that plays when clicking the volume slider in quick settings), although audio in general was working on your PC. [Other] Fixed an underlying issue which was causing fonts in certain app menu items to unexpectedly appear corrupted or overlapped for some people. This also impacted typing in Word – where when using Hebrew a period may unexpectedly show as a 3, and in Thai typing space may show a 2. Fixed an underlying issue which could cause the playback controls in Media Player to become distorted in the latest Canary flights. Fixed an underlying issue believed to be the cause of LDAP queries from apps to take an unexpectedly long time in the previous flight. Fixed an issue which could cause print previews to appear slightly blurry in recent Canary flights. Here is the list of known issues: [General] [IMPORTANT NOTE FOR COPILOT+ PCs] If you are joining the Canary Channel on a new Copilot+ PC from the Dev Channel, Release Preview Channel or retail, you will lose Windows Hello pin and biometrics to sign into your PC with error 0xd0000225 and error message “Something went wrong, and your PIN isn’t available”. You should be able to re-create your PIN by clicking “Set up my PIN”. [Settings] [NEW] We’re investigating an issue in this build which could cause Settings to crash when interacting with the options under Settings > System > Power & Battery. [Remote Desktop] [NEW] You may see extreme graphical distortion and rendering issues using remote desktop on Arm64 PCs in this build. You can find full release notes for build 27891 in a post on the official Windows Blogs website.
    • Sounds like corporate spamming being painted as a "feature"...so long as it can be blocked like any other random creep messaging you, no biggie.
  • Recent Achievements

    • Week One Done
      Devesh Beri earned a badge
      Week One Done
    • Week One Done
      956400 earned a badge
      Week One Done
    • First Post
      loose_observer earned a badge
      First Post
    • Week One Done
      BeeJay_Balu earned a badge
      Week One Done
    • Week One Done
      filminutz earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      468
    2. 2
      ATLien_0
      159
    3. 3
      +FloatingFatMan
      150
    4. 4
      Nick H.
      66
    5. 5
      +thexfile
      62
  • Tell a friend

    Love Neowin? Tell a friend!