PC Review


Reply
Thread Tools Rate Thread

BUG?? App Config and form corruption

 
 
Chris Dunaway
Guest
Posts: n/a
 
      17th Aug 2004
I was working on a Windows Forms app. The main form had a tab control, a
number of tabs with labels and buttons, etc. It is a new project so not
much work has been completed yet.

I added an app.config file to the project and then added appSettings
section to the file as shown below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="KeyName" Value="Value"
</appSettings>
</configuration>

Notice that I forgot to put the closing tag on the <add element.

The result was hundreds of error like the following in the task list:

Code generation for property 'Text' failed. Error was: 'There was an error
loading app.config. Since the document being loaded uses Dynamic
Properties, the config file must be valid. Correct the following error in
app.config:

This is an unexpected token. The expected token is 'NAME'. Line 5, position
9.'

What happened was that the form designer rewrote many many lines of my
InitializeComponent method and many controls disappeared or were changed.

Fortunately, I had checked the code into source control the day before so I
didn't lose anything. But it seems quite a severe reaction on the part of
the form designer to completely re-write the InitializeCode method just
because of a small ommision.

Has anyone else experienced this sort of thing? Are there any articles
availble that describe this issue in more detail?

Making sure the app.config file is correct seems to have fixed the problem.
--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Reply With Quote
 
 
 
 
Andy Becker
Guest
Posts: n/a
 
      17th Aug 2004
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:1rwboqedl4c8w.11u5bg4sdc94b$.(E-Mail Removed)...
> I was working on a Windows Forms app. The main form had a tab control, a
> number of tabs with labels and buttons, etc. It is a new project so not
> much work has been completed yet.
>
> I added an app.config file to the project and then added appSettings
> section to the file as shown below:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <add key="KeyName" Value="Value"
> </appSettings>
> </configuration>
>
> Notice that I forgot to put the closing tag on the <add element.
>
> The result was hundreds of error like the following in the task list:
>
> Code generation for property 'Text' failed. Error was: 'There was an

error
> loading app.config. Since the document being loaded uses Dynamic
> Properties, the config file must be valid. Correct the following error in
> app.config:
>
> This is an unexpected token. The expected token is 'NAME'. Line 5,

position
> 9.'
>
> What happened was that the form designer rewrote many many lines of my
> InitializeComponent method and many controls disappeared or were changed.
>
> Fortunately, I had checked the code into source control the day before so

I
> didn't lose anything. But it seems quite a severe reaction on the part of
> the form designer to completely re-write the InitializeCode method just
> because of a small ommision.
>
> Has anyone else experienced this sort of thing? Are there any articles
> availble that describe this issue in more detail?
>
> Making sure the app.config file is correct seems to have fixed the

problem.
> --
> Chris


Wild. Are any of your controls, either intentionally or unintentionally,
accessing ConfigurationSettings in their constructors or properties? It
sounds like something is, and might need to be "protected" with a test for
Me.DesignMode. I am confused as to why it would actually find/read the
config file at design time, though?

Best Regards,

Andy


 
Reply With Quote
 
Chris Dunaway
Guest
Posts: n/a
 
      17th Aug 2004
On Tue, 17 Aug 2004 10:39:22 -0500, Andy Becker wrote:

>
> Wild. Are any of your controls, either intentionally or unintentionally,
> accessing ConfigurationSettings in their constructors or properties? It


Not that I can tell. The xml I posted in my original post was the enitre
app.config file. I had just forgotten to include the closing tag on the
<add> element. That is what caused it.

To me, this is a bug. If the designer detects that the app.config is not
well formed then it should abort the code generation phase and report the
error.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System32 Config file corruption Linda Windows XP Accessibility 1 28th Sep 2004 03:09 AM
System32 Config file corruption Linda Windows XP Accessibility 0 27th Sep 2004 09:06 PM
Boot file corruption/c:windows/system32/config etc =?Utf-8?B?ZGFycmVuaGl0Y2g=?= Windows XP New Users 7 11th Jul 2004 03:39 AM
Repeated Boot Config Corruption in XP Pro davelonico Windows XP Performance 4 18th Apr 2004 11:40 PM
\windows\system32\config\system corruption Carl Newburg C & N Computer Services Windows XP General 2 23rd Jul 2003 12:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:43 PM.