Topics: Developer Forum
Sep 14, 2007 at 6:22 PM
Who did comment out the following line, and why? It does compile nicely on my machine, and I see no reason why it wouldn't.

            private ConnectionOptions GetConnectionOptions()
                ConnectionOptions options = new ConnectionOptions();
                if (Command.Credential != null)
                    // TODO: Commented out because it doesn't compile: options.SecurePassword = Command.Credential.Password;
                    // jachymko: can't help it, but it _does_ compile.
                    options.Username = Command.Credential.UserName;
                    options.SecurePassword = Command.Credential.Password;
                return options;
Sep 15, 2007 at 8:50 PM
A quick peek at the file's history would show that I'm the only other person that has touched the file besides you. And no, it wouldn't compile on my system. SecureString appears to be new to .NET 3.5. Remember I would like for PSCX to require no more than .NET Framework 2.0 for a while longer.

As you can see - no SecurePassword property on my system (.NET 2.0 & .NET 3.0):

125> new System.Management.ConnectionOptions | gm
   TypeName: System.Management.ConnectionOptions
Name                 MemberType Definition
----                 ---------- ----------
Clone                Method     System.Object Clone()
Equals               Method     System.Boolean Equals(Object obj)
GetHashCode          Method     System.Int32 GetHashCode()
GetType              Method     System.Type GetType()
get_Authentication   Method     System.Management.AuthenticationLevel get_Authentication()
get_Authority        Method     System.String get_Authority()
get_Context          Method     System.Management.ManagementNamedValueCollection get_Context()
get_EnablePrivileges Method     System.Boolean get_EnablePrivileges()
get_Impersonation    Method     System.Management.ImpersonationLevel get_Impersonation()
get_Locale           Method     System.String get_Locale()
get_Timeout          Method     System.TimeSpan get_Timeout()
get_Username         Method     System.String get_Username()
set_Authentication   Method     System.Void set_Authentication(AuthenticationLevel value)
set_Authority        Method     System.Void set_Authority(String value)
set_Context          Method     System.Void set_Context(ManagementNamedValueCollection value)
set_EnablePrivileges Method     System.Void set_EnablePrivileges(Boolean value)
set_Impersonation    Method     System.Void set_Impersonation(ImpersonationLevel value)
set_Locale           Method     System.Void set_Locale(String value)
set_Password         Method     System.Void set_Password(String value)
set_Timeout          Method     System.Void set_Timeout(TimeSpan value)
set_Username         Method     System.Void set_Username(String value)
ToString             Method     System.String ToString()
Authentication       Property   System.Management.AuthenticationLevel Authentication {get;set;}
Authority            Property   System.String Authority {get;set;}
Context              Property   System.Management.ManagementNamedValueCollection Context {get;set;}
EnablePrivileges     Property   System.Boolean EnablePrivileges {get;set;}
Impersonation        Property   System.Management.ImpersonationLevel Impersonation {get;set;}
Locale               Property   System.String Locale {get;set;}
Password             Property   System.String Password {set;}
Timeout              Property   System.TimeSpan Timeout {get;set;}
Username             Property   System.String Username {get;set;}
Sep 16, 2007 at 12:17 AM
hmm, seems like they've added it in the .net 2.0 service pack which is included in .net 3.5 :(( this is kind of stupid. i follow why they need to change things in to support LINQ etc., or fix things in the new 3.0 libraries, which are not as widely adopted yet. but adding new members all over the good ol' 2.0 makes it really hard to develop for the "old 2.0" from a machine with the "new 2.0" installed :(
Sep 16, 2007 at 1:55 AM
You've got to be kidding me! They added this method in .NET 2.0 SP? I could update (and probably should) to SP1 but we probably don't want to require .NET 2.0 SP1, do we?
Sep 16, 2007 at 2:09 AM
Edited Sep 16, 2007 at 2:09 AM
I think SecureString is .Net 2.0 + XP SP2 or Windows 2000 SP3?

see here:
Sep 16, 2007 at 4:34 AM
SecureString is part of .NET 2.0 however the issue is with the System.Management.ConnectionOptions.SecurePassword property. It looks to me that SecurePassword is a new property in .NET 3.5 because it isn't present up to and including .NET 3.0:
Sep 16, 2007 at 6:06 PM
.NET 3.5 consists of .NET 2.0 and 3.0 service packs + the new assemblies (which have version number 3.5). The existing assemblies keep the original assembly version (only the file version has increased). There is A LOT of changes to WPF, for example. But I didn't know they added things to the 2.0 assemblies as well.
The 2.0 and 3.0 service packs are not yet available separately (ie. without .NET 3.5), but they should be once .NET 3.5 RTMs (AFAIK).
Sep 17, 2007 at 12:50 AM
wow, that is some seriously funky versioning problem there. this is utterly unexpected...