[Mono-bugs] [Bug 566152] New: Environment.GetEnvironmentVariable may return null even if the variable exists

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 18 17:21:58 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=566152

http://bugzilla.novell.com/show_bug.cgi?id=566152#c0


           Summary: Environment.GetEnvironmentVariable may return null
                    even if the variable exists
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tomas.matousek at microsoft.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=333506)
 --> (http://bugzilla.novell.com/attachment.cgi?id=333506)
a.cs and main.cs

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; MALC)

If a C# application is started with environment string that contains an
environment variable with no value, for example
'VAR1=VALUE1\0EMPTY_VAR=\0VAR3=VALUE3\0\0', then
Environment.GetEnvironmentVariable("EMPTY_VAR") returns null. It should return
an empty string since the variable exists and its value is empty. 

The same issue applies on Environment.GetEnvironmentVariables().

Reproducible: Always

Steps to Reproduce:
0. unzip attachment to get files a.cs and main.cs
1. csc /unsafe a.cs
2. csc main.cs
3. mono main.exe 
   mono.exe must be on %PATH%
4. main.exe (for comparison with .NET)
Actual Results:  
..
'EMPTY_VARIABLE='
..

GetEnvironmentVariables:
EMPTY_VARIABLE -> null

GetEnvironmentVariable(EMPTY_VARIABLE):
null

Expected Results:  
..
'EMPTY_VARIABLE='
..

GetEnvironmentVariables:
EMPTY_VARIABLE -> 

GetEnvironmentVariable(EMPTY_VARIABLE):

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list