I'm running a wpf windows app and want to add the appSettings element to the
config file. when I do, the app wont start up and I get the following
error:
{"The type initializer for 'System.Windows.Application' threw an
exception."}
{"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw
an exception."}
" at System.Windows.Application..ctor()\r\n at
DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in
D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool_v 1\\obj\\Debug\\App.g.cs:line
0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)\r\n at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()\r\n at
System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at
System.Threading.ExecutionContext.Run(ExecutionCon text executionContext,
ContextCallback callback, Object state)\r\n at
System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the
appSettings element somewhere else now? Isnt there a tool I can use to
create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail 7 11084
Did not do it for me. I just created a Windows application in C# had a Form,
with one button and to show a messagebox in the button click event. I add
the information you gave to the config file, it opened ok!
keep a break point at Application.Run and debug. Is not even going beyond
it?
VJ
"moondaddy" <mo*******@noemail.noemailwrote in message
news:uO****************@TK2MSFTNGP06.phx.gbl...
I'm running a wpf windows app and want to add the appSettings element to
the config file. when I do, the app wont start up and I get the
following error:
{"The type initializer for 'System.Windows.Application' threw an
exception."}
{"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw
an exception."}
" at System.Windows.Application..ctor()\r\n at
DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in
D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool_v 1\\obj\\Debug\\App.g.cs:line
0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)\r\n at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()\r\n at
System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at
System.Threading.ExecutionContext.Run(ExecutionCon text executionContext,
ContextCallback callback, Object state)\r\n at
System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the
appSettings element somewhere else now? Isnt there a tool I can use to
create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail
He's doing WPF. YOu have to create a WPF Windows Application to test out
what he's doing.
moondaddy -- how are you adding the info to the config file? Are you using
C# or VB?
Robin S.
--------------------------------
"VJ" <no***********@yahoo.comwrote in message
news:ui**************@TK2MSFTNGP05.phx.gbl...
Did not do it for me. I just created a Windows application in C# had a
Form, with one button and to show a messagebox in the button click event.
I add the information you gave to the config file, it opened ok!
keep a break point at Application.Run and debug. Is not even going beyond
it?
VJ
"moondaddy" <mo*******@noemail.noemailwrote in message
news:uO****************@TK2MSFTNGP06.phx.gbl...
>I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error:
{"The type initializer for 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool_ v1\\obj\\Debug\\App.g.cs:line 0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.Ru nUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<appSettings> <add key="RunFrom" value="Voyager" /> </appSettings>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the appSettings element somewhere else now? Isnt there a tool I can use to create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail
Ahh WPF.. never gone there yet.. You will get better response from WPF
specific group..
VJ
"moondaddy" <mo*******@noemail.noemailwrote in message
news:uO****************@TK2MSFTNGP06.phx.gbl...
I'm running a wpf windows app and want to add the appSettings element to
the config file. when I do, the app wont start up and I get the
following error:
{"The type initializer for 'System.Windows.Application' threw an
exception."}
{"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw
an exception."}
" at System.Windows.Application..ctor()\r\n at
DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in
D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool_v 1\\obj\\Debug\\App.g.cs:line
0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)\r\n at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()\r\n at
System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at
System.Threading.ExecutionContext.Run(ExecutionCon text executionContext,
ContextCallback callback, Object state)\r\n at
System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
<configSections>
</configSections>
<connectionStrings>
<add name="some string...." />
</connectionStrings>
</configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the
appSettings element somewhere else now? Isnt there a tool I can use to
create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail
The problem is there isn't one, per se. There's
microsoft.public.windows.developer.winfx.avalon, but it doesn't have a lot
of traffic.
Other than that, there is the MSDN forum for WPF. I think this guy has the
support option from MS, though, because eventually they will answer his
question. In order for that to happen, he has to post it to one of the
managed newsgroups, of which this is one.
Robin S.
-----------------------------
"VJ" <no***********@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Ahh WPF.. never gone there yet.. You will get better response from WPF
specific group..
VJ
"moondaddy" <mo*******@noemail.noemailwrote in message
news:uO****************@TK2MSFTNGP06.phx.gbl...
>I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error:
{"The type initializer for 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool_ v1\\obj\\Debug\\App.g.cs:line 0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.Ru nUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<appSettings> <add key="RunFrom" value="Voyager" /> </appSettings>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the appSettings element somewhere else now? Isnt there a tool I can use to create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail
Hi Moondaddy,
Regarding on the WPF application, normally adding AppSetting keys should
not affect your application's runtime behavior. From the error message you
posted, the problem seems occur at type's initialize time. If possible,
would you post some detailed code snippet (you can try creating a
simplified project which can repro the same error behavior) so that we can
perform some further investigation on this?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks to all who have been responding.
1) Yes I get support from MS here so I post WPF questions here rather than
the MSND forums (although I go there some as well).
2) Here's the code from the app.config file where I'm having my trouble:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
<configSections>
</configSections>
<connectionStrings>
<add
name="DiagramTools.Properties.Settings.DiagramTool ConnectionString"
connectionString="xxxxxxxxxxxxxxxxxx"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
and when I remove this code all works fine:
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
does this shed any light?
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:mY******************************@comcast.com. ..
The problem is there isn't one, per se. There's
microsoft.public.windows.developer.winfx.avalon, but it doesn't have a lot
of traffic.
Other than that, there is the MSDN forum for WPF. I think this guy has the
support option from MS, though, because eventually they will answer his
question. In order for that to happen, he has to post it to one of the
managed newsgroups, of which this is one.
Robin S.
-----------------------------
"VJ" <no***********@yahoo.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Ahh WPF.. never gone there yet.. You will get better response from WPF specific group..
VJ "moondaddy" <mo*******@noemail.noemailwrote in message news:uO****************@TK2MSFTNGP06.phx.gbl...
>>I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error:
{"The type initializer for 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramTool _v1\\obj\\Debug\\App.g.cs:line 0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.R unUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Contex t(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionC ontext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<appSettings> <add key="RunFrom" value="Voyager" /> </appSettings>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the appSettings element somewhere else now? Isnt there a tool I can use to create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail
I found the problem. my solution has many projects and one of them also had
an app config file which also had an appSettings element in it. this
created a conflict when I added another appSettings element to a different
project.
"moondaddy" <mo*******@noemail.noemailwrote in message
news:uG**************@TK2MSFTNGP05.phx.gbl...
Thanks to all who have been responding.
1) Yes I get support from MS here so I post WPF questions here rather
than the MSND forums (although I go there some as well).
2) Here's the code from the app.config file where I'm having my trouble:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
<configSections>
</configSections>
<connectionStrings>
<add
name="DiagramTools.Properties.Settings.DiagramTool ConnectionString"
connectionString="xxxxxxxxxxxxxxxxxx"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
and when I remove this code all works fine:
<appSettings>
<add key="RunFrom" value="Voyager" />
</appSettings>
does this shed any light?
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:mY******************************@comcast.com. ..
>The problem is there isn't one, per se. There's microsoft.public.windows.developer.winfx.avalon , but it doesn't have a lot of traffic.
Other than that, there is the MSDN forum for WPF. I think this guy has the support option from MS, though, because eventually they will answer his question. In order for that to happen, he has to post it to one of the managed newsgroups, of which this is one.
Robin S. ----------------------------- "VJ" <no***********@yahoo.comwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Ahh WPF.. never gone there yet.. You will get better response from WPF specific group..
VJ "moondaddy" <mo*******@noemail.noemailwrote in message news:uO****************@TK2MSFTNGP06.phx.gbl.. . I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error:
{"The type initializer for 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in D:\\nwis\\Apps\\WPF\\DiagramTool_v1\\DiagramToo l_v1\\obj\\Debug\\App.g.cs:line 0\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc. RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context( Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
the app will run when the config file looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
But not like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration>
<appSettings> <add key="RunFrom" value="Voyager" /> </appSettings>
<configSections> </configSections> <connectionStrings> <add name="some string...." /> </connectionStrings> </configuration>
Note: this DID work in a .net 1.1 app. Am I supposed to put the appSettings element somewhere else now? Isnt there a tool I can use to create config files through a windows UI?
Thanks.
-- mo*******@noemail.noemail This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Keith M |
last post by:
Hi,
I have found a very useful piece of code in the msdn which shows how to load
an xml config file, search for a particular value and replace it.
Could someone possibly convert it to C# from...
|
by: Not Available |
last post by:
On the host server:
namespace JCart.Common
public class JCartConfiguration : IConfigurationSectionHandler
private static String dbConnectionString;
public static String ConnectionString
{
get...
|
by: GrantS |
last post by:
I am unable to get the connection to work with using the app.config
file.
the connection works when I use 'in line' connection as below:...
|
by: hazz |
last post by:
I have spent more time than I care to admit trying to track down a very
subtle error.
Here is my app's xx.exe.config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>...
|
by: Derrick |
last post by:
I have a C# console app, MyApp, and am placing an application config file in
the same debug dir as MyApp.exe. I have named the file MyApp.config, and
MyApp.exe.config. I cannot read the...
|
by: Kenneth |
last post by:
Hi,
In web.config I have an appsettings:
<appSettings>
<add key="constring"
value="Server=localhost;UID=sa;PWD=secret;Database=myDB" />
</appSettings>
This is for my developing machine.
|
by: hazz |
last post by:
With this code, the config file(listed below) opens initially into the
datagrid display with only a plus sign '+'.
On clicking that, it becomes expanded to;
-
appsettings
add
When I click on...
|
by: Sergei Shelukhin |
last post by:
Hi.
Is is possible to divide appSetting in two, having some values stored
in web.config itself and some in a section referenced in appSettings
file="...." attribute?
|
by: Jeff |
last post by:
ASP.NET 2.0
I'm wondering how to add a custom setting into web.config. From this website
I'm doing a http request to another website, and I would like to have the
webaddress of this other...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |