WPF Application fails on startup with TypeInitializationException

前端 未结 10 819
Happy的楠姐
Happy的楠姐 2020-12-17 09:05

I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices \"Composite Application Guidance for WPF\". I\'ve followed

10条回答
  •  甜味超标
    2020-12-17 09:33

    Thanks @ima, your answer pointed me in the right direction. I was using an app.config file and it contained this:

    
      
        
      
      
        

    It seems the problem was the element because when I removed it the application ran fine. I was confused because Visual Studio 2008 added that when I checked the box to utilise the "Client Profile" available in 3.5 SP1.

    After some mucking about checking and un-checking the box I ended up with a configuration file like this:

    
      
        

    Which works!

    I'm not sure why the order of elements in the app.config is important - but it seems it is.

提交回复
热议问题