473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

a little help with application setting?! [ConfigurationErrorsException!]

Hi ,
I'm probably just doing something a little silly.
I get a System.Configuration.ConfigurationErrorsException!

This is my config file:
<configSections>
<section name="qConfig" type="QuickBuild.QConfig , QuickBuild" />
</configSections>
<qConfig
PathToDevEnv="D:\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"
ShellBuild="false"
ShellUpgrade="false"
/>

This is the code:
namespace QuickBuild
{
public class QConfig : ConfigurationSection
{
[ConfigurationProperty("PathToDevenv", IsRequired = true)]
public string PathToDevenv
{
get { return (string)base["PathToDevenv"]; }
}
[ConfigurationProperty("ShellBuild",IsRequired = true)]
public bool ShellBuild
{
get { return (bool)base["ShellBuild"]; }
}
[ConfigurationProperty("ShellUpgrade",IsRequired = true)]
public bool ShellUpgrade
{
get { return (bool)base["ShellUpgrade"]; }
}
}
}

And i get a *ConfigurationErrorsException* when i do this:
QConfig cfg = ConfigurationManager.GetSection("qConfig") as QConfig;
With:"An error occurred creating the configuration section handler for
qConfig: Could not load type 'QuickBuild.QConfig ' from assembly
'QuickBuild' "

I'm working with C# 2.0 under .NET 2.0

Thanks so much
Gideon

Mar 23 '07 #1
5 4494
On 23 Mar, 07:31, "giddy" <gidisr...@gmail.comwrote:
Hi ,
I'm probably just doing something a little silly.
I get a System.Configuration.ConfigurationErrorsException!

This is my config file:
<configSections>
<section name="qConfig" type="QuickBuild.QConfig , QuickBuild" />
</configSections>
<qConfig
PathToDevEnv="D:\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"
ShellBuild="false"
ShellUpgrade="false"
/>

This is the code:
namespace QuickBuild
{
public class QConfig : ConfigurationSection
{
[ConfigurationProperty("PathToDevenv", IsRequired = true)]
public string PathToDevenv
{
get { return (string)base["PathToDevenv"]; }
}
[ConfigurationProperty("ShellBuild",IsRequired = true)]
public bool ShellBuild
{
get { return (bool)base["ShellBuild"]; }
}
[ConfigurationProperty("ShellUpgrade",IsRequired = true)]
public bool ShellUpgrade
{
get { return (bool)base["ShellUpgrade"]; }
}
}

}

And i get a *ConfigurationErrorsException* when i do this:
QConfig cfg = ConfigurationManager.GetSection("qConfig") as QConfig;
With:"An error occurred creating the configuration section handler for
qConfig: Could not load type 'QuickBuild.QConfig ' from assembly
'QuickBuild' "

I'm working with C# 2.0 under .NET 2.0

Thanks so much
Gideon
No constructor?

Mar 23 '07 #2
On 23 Mar, 13:59, "DeveloperX" <nntp...@operamail.comwrote:
On 23 Mar, 07:31, "giddy" <gidisr...@gmail.comwrote:


Hi ,
I'm probably just doing something a little silly.
I get a System.Configuration.ConfigurationErrorsException!
This is my config file:
<configSections>
<section name="qConfig" type="QuickBuild.QConfig , QuickBuild" />
</configSections>
<qConfig
PathToDevEnv="D:\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"
ShellBuild="false"
ShellUpgrade="false"
/>
This is the code:
namespace QuickBuild
{
public class QConfig : ConfigurationSection
{
[ConfigurationProperty("PathToDevenv", IsRequired = true)]
public string PathToDevenv
{
get { return (string)base["PathToDevenv"]; }
}
[ConfigurationProperty("ShellBuild",IsRequired = true)]
public bool ShellBuild
{
get { return (bool)base["ShellBuild"]; }
}
[ConfigurationProperty("ShellUpgrade",IsRequired = true)]
public bool ShellUpgrade
{
get { return (bool)base["ShellUpgrade"]; }
}
}
}
And i get a *ConfigurationErrorsException* when i do this:
QConfig cfg = ConfigurationManager.GetSection("qConfig") as QConfig;
With:"An error occurred creating the configuration section handler for
qConfig: Could not load type 'QuickBuild.QConfig ' from assembly
'QuickBuild' "
I'm working with C# 2.0 under .NET 2.0
Thanks so much
Gideon

No constructor?- Hide quoted text -

- Show quoted text -
Ditch that idea, having a dumb ass moment. For some reason I suddenly
thought no constructor was the same as a private constructor,
forgetting everything I knew about OO :/

First the class is in the QuickBuild assembly and compiles? I've
copied config files from other projects and forgotten to update the
assembly part while remembering to update the class name.
Second have you tried setting all the attributes to IsRequired=false?
I've been desperately scanning for something in the wrong case.

Mar 23 '07 #3
Hi ,
Ditch that idea, having a dumb ass moment. For some reason I suddenly
thought no constructor was the same as a private constructor,
forgetting everything I knew about OO :/
haha , lol, i saw your other constructor post.
First the class is in the QuickBuild assembly and compiles? I've
copied config files from other projects and forgotten to update the
assembly part while remembering to update the class name.
Yes , it does!!
Second have you tried setting all the attributes to IsRequired=false?
I've been desperately scanning for something in the wrong case.
I removed all the IsRequired attributes after reading this:
http://doronsharp.spaces.live.com/?_...26ayear%3D2007

but now , regardless of whether i have Isrequired or not , the
following happens:
QConfig cfg = ConfigurationManager.GetSection("QConfig") as QConfig;
Debug.Print(cfg.PathToDevEnv);

I get a null reference exception , cfg turns out NULL! =S!

App.Config is fine , everything is defined!

Could you plz help!

thanks so much
Gideon

Mar 23 '07 #4
On 23 Mar, 19:09, "giddy" <gidisr...@gmail.comwrote:
Hi ,
Ditch that idea, having a dumb ass moment. For some reason I suddenly
thought no constructor was the same as a private constructor,
forgetting everything I knew about OO :/

haha , lol, i saw your other constructor post.
First the class is in the QuickBuild assembly and compiles? I've
copied config files from other projects and forgotten to update the
assembly part while remembering to update the class name.

Yes , it does!!
Second have you tried setting all the attributes to IsRequired=false?
I've been desperately scanning for something in the wrong case.

I removed all the IsRequired attributes after reading this:http://doronsharp.spaces.live.com/?_...ew=1&_c11_Blog...

but now , regardless of whether i have Isrequired or not , the
following happens:
QConfig cfg = ConfigurationManager.GetSection("QConfig") as QConfig;
Debug.Print(cfg.PathToDevEnv);

I get a null reference exception , cfg turns out NULL! =S!

App.Config is fine , everything is defined!

Could you plz help!

thanks so much
Gideon
Ha, yes. I feel a bit silly.

It's a bit complicated but I run 2.0 at home and 1.1 in the office.
Using the enterprise library it's fairly straight forward to deal with
these issues, but I wanted to test it under 2, so had to wait until
this evening. Anyway. I can replicate your error and I'll try and work
towards a solution (part of my dn2 education as it were).
Under 1.1 this sort of thing is commonly caused when the enterprise
library can't resolve the location of the object.
Things to keep in mind. The config file has to have a specific name,
exename.config iirc.
The config class must be fully qualified in the config.
There's an issue under 1.1 at least where you sometimes have to quit
VS and delete all the files and rebuild to get it to work.
By default it won't automatically copy the config file to the output
directory.
There's a config path that needs to be set under 1.1, will test that
tomorrow under 2.
I've tried most of the above to no avail so far :/

I'm sure someone more experienced than me will pop along shortly :)

I'm off out for a late night tipple with a friend, so I'll give it
another shot tomorrow (at the code, not the vodka ;) (unless the code
won't work!))
Mar 23 '07 #5
hi ,

Thank you so much for your concern. My internet connection broke down
for a few days so i was'nt able to reply.

Ha, yes. I feel a bit silly.

It's a bit complicated but I run 2.0 at home and 1.1 in the office.
Using the enterprise library it's fairly straight forward to deal with
these issues, but I wanted to test it under 2, so had to wait until
this evening. Anyway. I can replicate your error and I'll try and work
towards a solution (part of my dn2 education as it were).
Under 1.1 this sort of thing is commonly caused when the enterprise
library can't resolve the location of the object.
Things to keep in mind. The config file has to have a specific name,
exename.config iirc.
acutally i found out that , one needs to add App.Config and then VS
replaces App with the application name and <.exeand puts in in the
output directory.
The config class must be fully qualified in the config.
There's an issue under 1.1 at least where you sometimes have to quit
VS and delete all the files and rebuild to get it to work.
By default it won't automatically copy the config file to the output
directory.
There's a config path that needs to be set under 1.1, will test that
tomorrow under 2.
I've tried most of the above to no avail so far :/
Same here , i tried it all. Nothing.
I'm sure someone more experienced than me will pop along shortly :)

I'm off out for a late night tipple with a friend, so I'll give it
another shot tomorrow (at the code, not the vodka ;) (unless the code
won't work!))
Haha ! lol

its ok now , you've probably guessed by "shell build" i'm going to
fiddle with the registry , so i decided to put my configuration in the
registry too. (under HKLM\SOFTWARE)

I did pursue the app configuration mechanism because i dont hardly
know anything about it ,(i'm self taught =P ) i have a very serious
app that will need app configuration soon so if you or anyone knows of
a good example please post it here! This app (QuickBuild) is a small
little pet project i'm on because my stupid high school exams are
going on.(i hate high school =S )

Thanks again

Gideon
[Damn the google groups =X , this is the second time i'm posting this!
glad i saved it somewhere first (i have to do that when i'm on google
grps sometimes! =S)]

Mar 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
2
by: FrodoBaggins | last post by:
Dear Team, I am running Visual Studio 2003 Version 7.1.3088 on Windows Server 2003. I have written a C# application that must write to the event log. When it attempts to write to the event log,...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: Mark Kirkwood | last post by:
This caught me today : I switched on "log_statement=true" whilst examining a possible foreign key concurrency problem. I noticed that the generated foreign key check "SELECT 1 FROM ONLY ......
0
by: Al Fatykhov | last post by:
Using MABLE logic engine with existing .NET applications. MABLE web services provide an interface to MABLE business objects and logic. Let us review some technical details of the MABLE web...
9
by: Dave Booker | last post by:
When I run a particular application I've been working on for a while, it somehow finds a value for the Application Setting "Test.Properties.Settings.Default.ProjectPath", but I can't see where it...
3
by: Sheikko | last post by:
ADO.NET - Working with DataSet ========================= HI, I want to create an application that interact with a DB. I wont to use SQL statement, but I want to use DataSet. - I have created my...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
6
by: jabslim | last post by:
excuse me, im a newbie programmer and i need a code on how to to be able to send files from a mobile phone to a pc through bluetooth in vb.net can anyone post a code here on how to detect a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.