.net - WPF Application fails on startup with TypeInitializationException -


i have simple wpf application trying start. following microsoft patterns , practices "composite application guidance wpf". i've followed instructions wpf application fails "typeinitializationexception".

the innerexception property reveals "the type initializer 'system.windows.navigation.baseurihelper' threw exception."

here app.xaml:

<application x:class="mynamespace.app"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">     <application.resources>              </application.resources> </application> 

and here app.xaml.cs (exception thrown @ "public app()"):

public partial class app : application {     public app()     {         bootstrapper bootstrapper = new bootstrapper();         bootstrapper.run();     } } 

i have set "app" class startup object in project.

what going astray?

thanks @ima, answer pointed me in right direction. using app.config file , contained this:

<configuration>   <startup>     <supportedruntime version="v2.0.50727" sku="client"/>   </startup>   <configsections>     <section name="modules" type="microsoft.practices.composite.modularity.modulesconfigurationsection, microsoft.practices.composite"/>   </configsections>   <modules>     <module assemblyfile="modules/mynamespace.modules.modulename.dll" moduletype="mynamespace.modules.modulename.moduleclass" modulename="name"/>   </modules> </configuration> 

it seems problem <startup> element because when removed application ran fine. confused because visual studio 2008 added when checked box utilise "client profile" available in 3.5 sp1.

after mucking checking , un-checking box ended configuration file this:

<configuration>   <configsections>     <section name="modules" type="microsoft.practices.composite.modularity.modulesconfigurationsection, microsoft.practices.composite"/>   </configsections>   <modules>     <module assemblyfile="modules/mynamespace.modules.modulename.dll" moduletype="mynamespace.modules.modulename.moduleclass" modulename="name"/>   </modules>   <startup>     <supportedruntime version="v2.0.50727" sku="client"/>   </startup> </configuration> 

which works!

i'm not sure why order of elements in app.config important - seems is.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -