Bugs item #3032628, was opened at 2010-07-21 07:04
Message generated for change (Comment added) made by great123
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3032628&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.91-alpha1
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Bogdan P (lica-mobilu)
Assigned to: Nobody/Anonymous (nobody)
Summary: <sysinfo /> on x64 systems

Initial Comment:
On my W7x64 task <sysinfo /> does not work. Looking with reflector the error 
comes from:


public class PropertyDictionary : DictionaryBase
  - private static void ValidatePropertyName(string propertyName, Location 
location)

Output by Nant is:

Property name 'sys.env.CommonProgramFiles(x86)' is invalid.:
NAnt.Core.BuildException: Property name 'sys.env.CommonProgramFiles(x86)' is inv
alid.
   at NAnt.Core.PropertyDictionary.ValidatePropertyName(String propertyName, Loc
ation location)
   at NAnt.Core.PropertyDictionary.OnValidate(Object key, Object value)
   at System.Collections.DictionaryBase.System.Collections.IDictionary.set_Item(
Object key, Object value)
   at NAnt.Core.PropertyDictionary.set_Item(String name, String value)
   at NAnt.Core.Tasks.SysInfoTask.ExecuteTask()
   at NAnt.Core.Task.Execute()
   at NAnt.Core.Project.InitializeProjectDocument(XmlDocument doc)
   at NAnt.Core.Project.Execute()
   at NAnt.Core.Project.Run()

This show that this line of code from method above raises an error:


    if (!Regex.IsMatch(propertyName, @"^[_A-Za-z0-9][_A-Za-z0-9\-.]*$"))
    {
        throw new BuildException(string.Format(CultureInfo.InvariantCulture, 
ResourceUtils.GetString("NA1064"), new object[] { propertyName }), location);
    }

Solution:

Allow ( and ) in property name.

----------------------------------------------------------------------

Comment By: Great123 (great123)
Date: 2012-03-20 23:22

Message:
Hi,

I am facing the same issue(Property name 'sys.env.CommonProgramFiles(x86)'
is invalid) while using nant-0.91-alpha2. 

Please can you help me in which location of the code of  the sysinfo.cs i
need to add the failonerror="false". 

protected override void ExecuteTask()
        {
            Log(Level.Info, "Setting system information properties under "
+ Prefix + "*");

            // set properties
            Properties[Prefix + "clr.version"] =
Environment.Version.ToString();
            Properties[Prefix + "os.platform"] =
Environment.OSVersion.Platform.ToString(CultureInfo.InvariantCulture);
            Properties[Prefix + "os.version"] =
Environment.OSVersion.Version.ToString();
            Properties[Prefix + "os.folder.applicationdata"] =
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            Properties[Prefix + "os.folder.commonapplicationData"] =
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            Properties[Prefix + "os.folder.commonprogramFiles"] =
Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles);  
            Properties[Prefix + "os.folder.desktopdirectory"] =
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            Properties[Prefix + "os.folder.programfiles"] =
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);         
              
            Properties[Prefix + "os.folder.system"] =
Environment.GetFolderPath(Environment.SpecialFolder.System);
            Properties[Prefix + "os.folder.temp"] = Path.GetTempPath();
            Properties[Prefix + "os"] = Environment.OSVersion.ToString();

            // set environment variables
            IDictionary variables = Environment.GetEnvironmentVariables();
            foreach (string name in variables.Keys)
            {
                try
                {
                    Properties[Prefix + "env." + name] =
(string)variables[name];
                }
                catch (Exception ex)
                {
                    if (!FailOnError)
                    {
                        Log(Level.Warning, "Property could not be created
for"
                            + " environment variable '{0}' : {1}", name,
                            ex.Message);
                    }
                    else
                    {
                        throw;
                    }
                    
                }
            }

            // display the properties
            if (Verbose)
            {
                foreach (DictionaryEntry entry in Properties)
                {
                    string name = (string)entry.Key;
                    if (name.StartsWith(Prefix))
                    {
                        Log(Level.Info, name + " = " +
entry.Value.ToString());
                    }
                }
            }
        }

        #endregion Override implementation of Task
    }


----------------------------------------------------------------------

Comment By: Dominik Guder (dogu)
Date: 2010-08-14 14:19

Message:
Hi,
the discussion along with my pathes were done at 
http://sourceforge.net/mailarchive/message.php?msg_name=4BA945CE.30907%40guder.org
or alternative http://old.nabble.com/sysinfo-task-ts28008307.html

I still suggest to use parens replacement with _ in sysinfo task and add
this clearly in docu. Maybe add a mapper as suggested by Gert, but only if
we need it otherwhere too.
So far
Dominik

----------------------------------------------------------------------

Comment By: Ryan Boggs (rmboggs)
Date: 2010-08-13 14:17

Message:
I am going through my email and remembering a reference to this bug:
https://sourceforge.net/tracker/?func=detail&aid=1082225&group_id=31650&atid=402868

----------------------------------------------------------------------

Comment By: Ryan Boggs (rmboggs)
Date: 2010-08-13 14:14

Message:
Ugg, this error.  This one is complicated because of this task uses the
same check system that is used to validate variable names, if I remember
correctly.  At the time we found it, it was decided that the work around
that Dominik described would be sufficient.  However, as more systems go
the x64 route, I can see this needing more attention.

----------------------------------------------------------------------

Comment By: Dominik Guder (dogu)
Date: 2010-07-30 21:31

Message:
Hi,
I stubled about this issue some other day before releasing 0.90. 
The reason is the function parser which needs the parens as separator to
work correctly. Therefore they are excluded from property names.
I did some checkings like renaming ( and ) to _. But finally we did not
came to an acceptable  solution what to do now and posponed the issue.

Until we grab this issue again, the only way is to set failonerror="false"
on sysinfo task.

So far Dominik

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3032628&group_id=31650

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to