Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

PowerShell/PShell Get-Member formatting not the same as v35

Aug
2,799
144
In TCC v35, this is how Get-Member output is displayed using PShell,
Code:
E:\Utils>pshell /s "[AddClass] | get-member -static"


   TypeName: AddClass

Name            MemberType Definition
----            ---------- ----------
Add             Method     static long Add(long i, long j)
Equals          Method     static bool Equals(System.Object objA, System.Object objB)
new             Method     AddClass new()
PPP             Method     static double PPP(double ppk)
ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)



E:\Utils>ver

TCC  35.00.21 x64   Windows 10 [Version 10.0.19045.7058]

In TCC v36, this is how Get-Member output is displayed using PShell,
Code:
U:\>pshell /s "[AddClass] | get-member -static"
static long Add(long i, long j)
static bool Equals(System.Object objA, System.Object objB)
AddClass new()
static double PPP(double ppk)
static bool ReferenceEquals(System.Object objA, System.Object objB)

U:\>ver

TCC  36.00.17 x64   Windows 10 [Version 10.0.19045.7058]

Code:
PS E:\utils> [AddClass] | get-member -static


   TypeName: AddClass

Name            MemberType Definition
----            ---------- ----------
Add             Method     static long Add(long i, long j)
Equals          Method     static bool Equals(System.Object objA, System.Object objB)
new             Method     AddClass new()
PPP             Method     static double PPP(double ppk)
ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)


PS E:\utils> $PSversionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.7058
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.7058
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Please make the output for Get-Member in TCC v36 be the same as it is in TCC v35,
that is,
the same as output for Get-Member is in PowerShell.

Joe
 
PSHELL in v35 and v36 share exactly zero lines of code.

I am not going to delay releasing v36 by (several?) months trying to create byte-for-byte formatting compatibility with a deprecated dll that was broken anyway in recent Windows builds. The choice here is either to include the new Powershell interface code in v36 and gradually improve it, or drop Powershell support entirely (which was my original intention for v36).

I cannot attempt to reproduce your formatting issue here, because Powershell doesn't know what [AddClass] is:

Code:
PS C:\Users\Rex Conn>  [AddClass] | get-member -static
InvalidOperation: Unable to find type [AddClass].
 
I am not going to delay releasing v36 by (several?) months trying to create byte-for-byte formatting compatibility

I am not asking for compatibility "with a deprecated dll that was broken anyway in recent Windows builds"

I'm asking for compatibility with PowerShell.

Code:
R:\>ver

TCC  36.00.17 x64   Windows 10 [Version 10.0.19045.7058]

R:\>pshell /s "[DateTime] | get-member -static"
static int Compare(datetime t1, datetime t2)
static int DaysInMonth(int year, int month)
static bool Equals(datetime t1, datetime t2), static bool Equals(System.Object objA, System.Object objB)
static datetime FromBinary(long dateData)
static datetime FromFileTime(long fileTime)
static datetime FromFileTimeUtc(long fileTime)
static datetime FromOADate(double d)
static bool IsLeapYear(int year)
datetime new(long ticks), datetime new(long ticks, System.DateTimeKind kind), datetime new(int year, int month, int day), datetime new(int year, int month, int day, System.Globalization.Calendar calendar), datetime new(int year, int month, int day, int hour, int minute, int second), datetime new(int year, int month, int day, int hour, int minute, int second, System.DateTimeKind kind), datetime new(int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar), datetime new(int year, int month, int day, int hour, int minute, int second, int millisecond), datetime new(int year, int month, int day, int hour, int minute, int second, int millisecond, System.DateTimeKind kind), datetime new(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar), datetime new(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.DateTimeKind kind)
static datetime Parse(string s), static datetime Parse(string s, System.IFormatProvider provider), static datetime Parse(string s, System.IFormatProvider provider, System.Globalization.DateTimeStyles styles)
static datetime ParseExact(string s, string format, System.IFormatProvider provider), static datetime ParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style), static datetime ParseExact(string s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style)
static bool ReferenceEquals(System.Object objA, System.Object objB)
static datetime SpecifyKind(datetime value, System.DateTimeKind kind)
static bool TryParse(string s, [ref] datetime result), static bool TryParse(string s, System.IFormatProvider provider, System.Globalization.DateTimeStyles styles, [ref] datetime result)
static bool TryParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style, [ref] datetime result), static bool TryParseExact(string s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style, [ref] datetime result)
static datetime MaxValue {get;}
static datetime MinValue {get;}
datetime Now {get;}
datetime Today {get;}
datetime UtcNow {get;}

Code:
PS E:\utils> [DateTime] | get-member -static


   TypeName: System.DateTime

Name            MemberType Definition
----            ---------- ----------
Compare         Method     static int Compare(datetime t1, datetime t2)
DaysInMonth     Method     static int DaysInMonth(int year, int month)
Equals          Method     static bool Equals(datetime t1, datetime t2), static bool Equals(System.Object objA, System.Object objB)
FromBinary      Method     static datetime FromBinary(long dateData)
FromFileTime    Method     static datetime FromFileTime(long fileTime)
FromFileTimeUtc Method     static datetime FromFileTimeUtc(long fileTime)
FromOADate      Method     static datetime FromOADate(double d)
IsLeapYear      Method     static bool IsLeapYear(int year)
new             Method     datetime new(long ticks), datetime new(long ticks, System.DateTimeKind kind), datetime new(int year, int month, in...
Parse           Method     static datetime Parse(string s), static datetime Parse(string s, System.IFormatProvider provider), static datetime...
ParseExact      Method     static datetime ParseExact(string s, string format, System.IFormatProvider provider), static datetime ParseExact(s...
ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)
SpecifyKind     Method     static datetime SpecifyKind(datetime value, System.DateTimeKind kind)
TryParse        Method     static bool TryParse(string s, [ref] datetime result), static bool TryParse(string s, System.IFormatProvider provi...
TryParseExact   Method     static bool TryParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeS...
MaxValue        Property   static datetime MaxValue {get;}
MinValue        Property   static datetime MinValue {get;}
Now             Property   datetime Now {get;}
Today           Property   datetime Today {get;}
UtcNow          Property   datetime UtcNow {get;}


PS E:\utils> [DateTime] | get-member


   TypeName: System.RuntimeType

Name                           MemberType Definition
----                           ---------- ----------
AsType                         Method     type AsType()
Clone                          Method     System.Object Clone(), System.Object ICloneable.Clone()
Equals                         Method     bool Equals(System.Object obj), bool Equals(type o), bool _MemberInfo.Equals(System.Object other), ...
FindInterfaces                 Method     type[] FindInterfaces(System.Reflection.TypeFilter filter, System.Object filterCriteria), type[] _T...
FindMembers                    Method     System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflect...
GetArrayRank                   Method     int GetArrayRank(), int _Type.GetArrayRank()
GetConstructor                 Method     System.Reflection.ConstructorInfo GetConstructor(System.Reflection.BindingFlags bindingAttr, System...
GetConstructors                Method     System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr), Sy...
GetCustomAttributes            Method     System.Object[] GetCustomAttributes(bool inherit), System.Object[] GetCustomAttributes(type attribu...
GetCustomAttributesData        Method     System.Collections.Generic.IList[System.Reflection.CustomAttributeData] GetCustomAttributesData()
GetDeclaredEvent               Method     System.Reflection.EventInfo GetDeclaredEvent(string name)
GetDeclaredField               Method     System.Reflection.FieldInfo GetDeclaredField(string name)
GetDeclaredMethod              Method     System.Reflection.MethodInfo GetDeclaredMethod(string name)
GetDeclaredMethods             Method     System.Collections.Generic.IEnumerable[System.Reflection.MethodInfo] GetDeclaredMethods(string name)
GetDeclaredNestedType          Method     System.Reflection.TypeInfo GetDeclaredNestedType(string name)
GetDeclaredProperty            Method     System.Reflection.PropertyInfo GetDeclaredProperty(string name)
GetDefaultMembers              Method     System.Reflection.MemberInfo[] GetDefaultMembers(), System.Reflection.MemberInfo[] _Type.GetDefault...
GetElementType                 Method     type GetElementType(), type _Type.GetElementType()
GetEnumName                    Method     string GetEnumName(System.Object value)
GetEnumNames                   Method     string[] GetEnumNames()
GetEnumUnderlyingType          Method     type GetEnumUnderlyingType()
GetEnumValues                  Method     array GetEnumValues()
GetEvent                       Method     System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr), Syst...
GetEvents                      Method     System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr), System.Reflect...
GetField                       Method     System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr), Syst...
GetFields                      Method     System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr), System.Reflect...
GetGenericArguments            Method     type[] GetGenericArguments()
GetGenericParameterConstraints Method     type[] GetGenericParameterConstraints()
GetGenericTypeDefinition       Method     type GetGenericTypeDefinition()
GetHashCode                    Method     int GetHashCode(), int _MemberInfo.GetHashCode(), int _Type.GetHashCode()
GetIDsOfNames                  Method     void _MemberInfo.GetIDsOfNames([ref] guid riid, System.IntPtr rgszNames, uint32 cNames, uint32 lcid...
GetInterface                   Method     type GetInterface(string fullname, bool ignoreCase), type GetInterface(string name), type _Type.Get...
GetInterfaceMap                Method     System.Reflection.InterfaceMapping GetInterfaceMap(type ifaceType), System.Reflection.InterfaceMapp...
GetInterfaces                  Method     type[] GetInterfaces(), type[] _Type.GetInterfaces()
GetMember                      Method     System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Re...
GetMembers                     Method     System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr), System.Refle...
GetMethod                      Method     System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, Sys...
GetMethods                     Method     System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr), System.Refle...
GetNestedType                  Method     type GetNestedType(string fullname, System.Reflection.BindingFlags bindingAttr), type GetNestedType...
GetNestedTypes                 Method     type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr), type[] GetNestedTypes(), type[] ...
GetObjectData                  Method     void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serializatio...
GetProperties                  Method     System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr), System....
GetProperty                    Method     System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr,...
GetType                        Method     type GetType(), type _MemberInfo.GetType(), type _Type.GetType()
GetTypeInfo                    Method     void _MemberInfo.GetTypeInfo(uint32 iTInfo, uint32 lcid, System.IntPtr ppTInfo), void _Type.GetType...
GetTypeInfoCount               Method     void _MemberInfo.GetTypeInfoCount([ref] uint32 pcTInfo), void _Type.GetTypeInfoCount([ref] uint32 p...
Invoke                         Method     void _MemberInfo.Invoke(uint32 dispIdMember, [ref] guid riid, uint32 lcid, int16 wFlags, System.Int...
InvokeMember                   Method     System.Object InvokeMember(string name, System.Reflection.BindingFlags bindingFlags, System.Reflect...
IsAssignableFrom               Method     bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo), bool IsAssignableFrom(type c), bool _Ty...
IsDefined                      Method     bool IsDefined(type attributeType, bool inherit), bool ICustomAttributeProvider.IsDefined(type attr...
IsEnumDefined                  Method     bool IsEnumDefined(System.Object value)
IsEquivalentTo                 Method     bool IsEquivalentTo(type other)
IsInstanceOfType               Method     bool IsInstanceOfType(System.Object o), bool _Type.IsInstanceOfType(System.Object o)
IsSubclassOf                   Method     bool IsSubclassOf(type type), bool _Type.IsSubclassOf(type c)
MakeArrayType                  Method     type MakeArrayType(), type MakeArrayType(int rank)
MakeByRefType                  Method     type MakeByRefType()
MakeGenericType                Method     type MakeGenericType(Params type[] instantiation)
MakePointerType                Method     type MakePointerType()
ToString                       Method     string ToString(), string _MemberInfo.ToString(), string _Type.ToString()
Assembly                       Property   System.Reflection.Assembly Assembly {get;}
AssemblyQualifiedName          Property   string AssemblyQualifiedName {get;}
Attributes                     Property   System.Reflection.TypeAttributes Attributes {get;}
BaseType                       Property   type BaseType {get;}
ContainsGenericParameters      Property   bool ContainsGenericParameters {get;}
CustomAttributes               Property   System.Collections.Generic.IEnumerable[System.Reflection.CustomAttributeData] CustomAttributes {get;}
DeclaredConstructors           Property   System.Collections.Generic.IEnumerable[System.Reflection.ConstructorInfo] DeclaredConstructors {get;}
DeclaredEvents                 Property   System.Collections.Generic.IEnumerable[System.Reflection.EventInfo] DeclaredEvents {get;}
DeclaredFields                 Property   System.Collections.Generic.IEnumerable[System.Reflection.FieldInfo] DeclaredFields {get;}
DeclaredMembers                Property   System.Collections.Generic.IEnumerable[System.Reflection.MemberInfo] DeclaredMembers {get;}
DeclaredMethods                Property   System.Collections.Generic.IEnumerable[System.Reflection.MethodInfo] DeclaredMethods {get;}
DeclaredNestedTypes            Property   System.Collections.Generic.IEnumerable[System.Reflection.TypeInfo] DeclaredNestedTypes {get;}
DeclaredProperties             Property   System.Collections.Generic.IEnumerable[System.Reflection.PropertyInfo] DeclaredProperties {get;}
DeclaringMethod                Property   System.Reflection.MethodBase DeclaringMethod {get;}
DeclaringType                  Property   type DeclaringType {get;}
FullName                       Property   string FullName {get;}
GenericParameterAttributes     Property   System.Reflection.GenericParameterAttributes GenericParameterAttributes {get;}
GenericParameterPosition       Property   int GenericParameterPosition {get;}
GenericTypeArguments           Property   type[] GenericTypeArguments {get;}
GenericTypeParameters          Property   type[] GenericTypeParameters {get;}
GUID                           Property   guid GUID {get;}
HasElementType                 Property   bool HasElementType {get;}
ImplementedInterfaces          Property   System.Collections.Generic.IEnumerable[type] ImplementedInterfaces {get;}
IsAbstract                     Property   bool IsAbstract {get;}
IsAnsiClass                    Property   bool IsAnsiClass {get;}
IsArray                        Property   bool IsArray {get;}
IsAutoClass                    Property   bool IsAutoClass {get;}
IsAutoLayout                   Property   bool IsAutoLayout {get;}
IsByRef                        Property   bool IsByRef {get;}
IsClass                        Property   bool IsClass {get;}
IsCOMObject                    Property   bool IsCOMObject {get;}
IsConstructedGenericType       Property   bool IsConstructedGenericType {get;}
IsContextful                   Property   bool IsContextful {get;}
IsEnum                         Property   bool IsEnum {get;}
IsExplicitLayout               Property   bool IsExplicitLayout {get;}
IsGenericParameter             Property   bool IsGenericParameter {get;}
IsGenericType                  Property   bool IsGenericType {get;}
IsGenericTypeDefinition        Property   bool IsGenericTypeDefinition {get;}
IsImport                       Property   bool IsImport {get;}
IsInterface                    Property   bool IsInterface {get;}
IsLayoutSequential             Property   bool IsLayoutSequential {get;}
IsMarshalByRef                 Property   bool IsMarshalByRef {get;}
IsNested                       Property   bool IsNested {get;}
IsNestedAssembly               Property   bool IsNestedAssembly {get;}
IsNestedFamANDAssem            Property   bool IsNestedFamANDAssem {get;}
IsNestedFamily                 Property   bool IsNestedFamily {get;}
IsNestedFamORAssem             Property   bool IsNestedFamORAssem {get;}
IsNestedPrivate                Property   bool IsNestedPrivate {get;}
IsNestedPublic                 Property   bool IsNestedPublic {get;}
IsNotPublic                    Property   bool IsNotPublic {get;}
IsPointer                      Property   bool IsPointer {get;}
IsPrimitive                    Property   bool IsPrimitive {get;}
IsPublic                       Property   bool IsPublic {get;}
IsSealed                       Property   bool IsSealed {get;}
IsSecurityCritical             Property   bool IsSecurityCritical {get;}
IsSecuritySafeCritical         Property   bool IsSecuritySafeCritical {get;}
IsSecurityTransparent          Property   bool IsSecurityTransparent {get;}
IsSerializable                 Property   bool IsSerializable {get;}
IsSpecialName                  Property   bool IsSpecialName {get;}
IsUnicodeClass                 Property   bool IsUnicodeClass {get;}
IsValueType                    Property   bool IsValueType {get;}
IsVisible                      Property   bool IsVisible {get;}
MemberType                     Property   System.Reflection.MemberTypes MemberType {get;}
MetadataToken                  Property   int MetadataToken {get;}
Module                         Property   System.Reflection.Module Module {get;}
Name                           Property   string Name {get;}
Namespace                      Property   string Namespace {get;}
ReflectedType                  Property   type ReflectedType {get;}
StructLayoutAttribute          Property   System.Runtime.InteropServices.StructLayoutAttribute StructLayoutAttribute {get;}
TypeHandle                     Property   System.RuntimeTypeHandle TypeHandle {get;}
TypeInitializer                Property   System.Reflection.ConstructorInfo TypeInitializer {get;}
UnderlyingSystemType           Property   type UnderlyingSystemType {get;}


PS E:\utils> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  7058
 
Looks good so far!

Thankyou Rex.

Code:
R:\>ver

TCC  36.00.19 x64   Windows 10 [Version 10.0.19045.7058]

R:\>which pshell
pshell is an internal command

R:\>pshell  /s "$jlc = new-object -com jlcUtils.clsMath"

R:\>pshell  /s "$jlc | Get-Member"
   TypeName: System.__ComObject#{6952cf31-c8e9-40a2-8e84-e3b7d2122072}
Name   MemberType Definition
----   ---------- ----------
ppp    Method     Variant ppp (Variant)
vb6Val Method     double vb6Val (string)
World  Method     Variant World (string)

R:\>pshell /s "$jlc.ppp(6.59)"
2.99186

Code:
R:\>ver

TCC  36.00.19 x64   Windows 10 [Version 10.0.19045.7058]

R:\>which pshell
pshell is an internal command

R:\>pshell /s "$fso = New-Object -ComObject Scripting.FileSystemObject"

R:\>pshell /s "$fso | Get-Member"
   TypeName: System.__ComObject#{2a0b9d10-4b87-11d3-a97a-00104b365c9f}
Name                MemberType Definition
----                ---------- ----------
BuildPath           Method     string BuildPath (string, string)
CopyFile            Method     void CopyFile (string, string, bool)
CopyFolder          Method     void CopyFolder (string, string, bool)
CreateFolder        Method     IFolder CreateFolder (string)
CreateTextFile      Method     ITextStream CreateTextFile (string, bool, bool)
DeleteFile          Method     void DeleteFile (string, bool)
DeleteFolder        Method     void DeleteFolder (string, bool)
DriveExists         Method     bool DriveExists (string)
FileExists          Method     bool FileExists (string)
FolderExists        Method     bool FolderExists (string)
GetAbsolutePathName Method     string GetAbsolutePathName (string)
GetBaseName         Method     string GetBaseName (string)
GetDrive            Method     IDrive GetDrive (string)
GetDriveName        Method     string GetDriveName (string)
GetExtensionName    Method     string GetExtensionName (string)
GetFile             Method     IFile GetFile (string)
GetFileName         Method     string GetFileName (string)
GetFileVersion      Method     string GetFileVersion (string)
GetFolder           Method     IFolder GetFolder (string)
GetParentFolderName Method     string GetParentFolderName (string)
GetSpecialFolder    Method     IFolder GetSpecialFolder (SpecialFolderConst)
GetStandardStream   Method     ITextStream GetStandardStream (StandardStreamTypes, bool)
GetTempName         Method     string GetTempName ()
MoveFile            Method     void MoveFile (string, string)
MoveFolder          Method     void MoveFolder (string, string)
OpenTextFile        Method     ITextStream OpenTextFile (string, IOMode, bool, Tristate)
Drives              Property   IDriveCollection Drives () {get}
 
Back
Top