App.InitializeComponent is not generated when StartupUri and Startup are missing - by Ralph Flora

Status : 

 


8
0
Sign in
to vote
ID 363934 Comments
Status Active Workarounds
Type Bug Repros 7
Opened 8/27/2008 9:27:08 AM
Access Restriction Public

Description

UPDATE:  I attached a zip that demonstrates the issue.  The readme.txt file in the solution goes into further detail.

I'm entering this as a bug although I suppose it's possible that it is by design.  I discovered this while playing around with the StockTraderRI application from WPF Composite Guidance.  Basically if the Startup and StartupUri attributes are not set on the Application tag in App.xaml, the App.g.cs file does not contain the InitializeComponent method.  This means that the resources do not appear to be loaded when accessing them through Application.Current.Resources.  I'm not sure if it causes any other problems, but that is the symptom I noticed. 
Sign in to post a comment.
Posted by dieunke on 2/20/2014 at 2:22 AM
The workaround mentioned above:
"The easiest workaround is to set the x:Name attribute on the <Application> element in XAML"
does work (i.e. everything looks fine and seems to work well), but the funktion InitializeComponent still does not exist.
Posted by Microsoft on 7/19/2012 at 10:12 PM
The WPF team has recently reviewed this issue and will not be addressing this issue as at this time the team is focusing on the bugs impacting the highest number of WPF developers. If you believe that this was resolved in error, please reactivate this bug with any necessary supporting details.
Posted by Brett Burkhart on 3/16/2012 at 1:31 PM
I'm seeing the same issue in VS 2010, but only recently did it start doing this. I've create dozens of WPF Application projects before, removed the StartupUri or Startup tags and the InitializeComponent method is still generated. For soem reason now, it magically is not doing it.
Posted by Lynn Keele on 12/3/2010 at 11:15 AM
Repro Steps are posted at
http://devlicio.us/blogs/rob_eisenberg/archive/2010/07/06/caliburn-micro-soup-to-nuts-pt-1-configuration-actions-and-conventions.aspx
Posted by omjbe on 7/11/2010 at 12:14 PM
This issue still exists in VS 2010 :-(.
Posted by Chango [MSFT] on 9/12/2008 at 12:45 AM
The easiest workaround is to set the x:Name attribute on the <Application> element in XAML. Then InitializeComponent() will be generated and called, and the ResourceDictionary will be loaded.
Posted by Microsoft on 8/31/2008 at 8:08 PM
Hi titojermaine

We were able to reproduce the issue you are seeing according to your feedback. We are escalating this bug to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release
Posted by Ralph Flora on 8/28/2008 at 7:06 AM
I attached a zip that demonstrates the issue. The readme.txt file in the solution goes into further detail.
Posted by Microsoft on 8/28/2008 at 12:34 AM
Thanks for reporting the issue.
In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.

It may help if you provide us with:
a zipped project file

It would be greatly appreciated if you could provide us with that information as quickly as possible. If we do not hear back from you within 7 days, we will close this issue


Thanks again for your efforts and we look forward to hearing from you.
Visual Studio Product Team