Hi Ian,
So I'm happy to go with Tomas's solution - leaving the sys properties
non read only.
OK, I'm game. I've done the fix and added a couple of new unit tests to the
SysInfo task to ensure both conditions hold true :)
While looking through the code, though, I noticed that the code in
While looking through the code, though, I noticed that the code in
PropertyDictionary's indexer is:
set {
if (!_readOnlyProperties.Contains(name)) {
Dictionary[name] = value;
}
}
Now, this will silently be ignored if the property is
readonly. Somehow, I
don't think this is
element could be used. Or maybe a different attribute name
instead of value, like value-if-undefined.
-Original Message-
From: Shaw, Gerry [mailto:grshaw;ea.com]
Sent: Saturday, October 19, 2002 2:04 PM
To: Tomas Restrepo; Nant-Developers (E-mail)
Subject: RE: [nant-dev] bug - Calling SysInfo
Hi Kevin,
I traced it to PropertyDictionary.cs not checking to see if a property was
already present before adding it.
Here is my fix sorry about the lack of diff. Basically added a check to
not
allow duplicates to the PropertyDictionary.
The fix seems to already have been commited by
+1
My proposal for a fix would actually be to leave PropertyDictionary
alone,
and instead modify SysInfo so that it uses indexer access to add it's
properties. That simple change would satisfy both elements I outline
above.
What does anybody else think?
--
Tomas Restrepo
Tomas Restrepo wrote:
The fix seems to already have been commited by someone else.
that was me :)
However, may I argue _against_ this fix?
There are two reasons I don't like it:
a- It changes semantics. PropertyDictionary inherits from DictionatyBase.
Common semantics in all of .NET
It might be uesful to be able to poke values into the
environment from the
build file for various tasks that use them.
When I get around to syncing my version and the public version of nant
I've made a change to the exec task that does something like this:
The task looks for properties