Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ orderby op

private static string GetOperatorDescription(string op)
{
return ResourceManagerCache.GetResourceString(typeof(CompletionCompleters).GetTypeInfo().Assembly,
return ResourceManagerCache.GetResourceString(typeof(CompletionCompleters).Assembly,
"System.Management.Automation.resources.TabCompletionStrings",
op + "OperatorDescription");
}
Expand Down Expand Up @@ -1639,7 +1639,7 @@ private static void ProcessParameter(
parameterType = parameterType.GetElementType();
}

if (parameterType.GetTypeInfo().IsEnum)
if (parameterType.IsEnum)
{
RemoveLastNullCompletionResult(result);

Expand Down Expand Up @@ -5468,15 +5468,13 @@ private class TypeCompletion : TypeCompletionBase

protected string GetTooltipPrefix()
{
TypeInfo typeInfo = Type.GetTypeInfo();

if (typeof(Delegate).IsAssignableFrom(Type))
return "Delegate ";
if (typeInfo.IsInterface)
if (Type.IsInterface)
return "Interface ";
if (typeInfo.IsClass)
if (Type.IsClass)
return "Class ";
if (typeInfo.IsEnum)
if (Type.IsEnum)
return "Enum ";
if (typeof(ValueType).IsAssignableFrom(Type))
return "Struct ";
Expand Down Expand Up @@ -6337,7 +6335,7 @@ internal static string CombineVariableWithPartialPath(VariableExpressionAst vari
if (strValue == null)
{
object baseObj = PSObject.Base(value);
if (baseObj is string || baseObj.GetType().GetTypeInfo().IsPrimitive)
if (baseObj is string || baseObj.GetType().IsPrimitive)
{
strValue = LanguagePrimitives.ConvertTo<string>(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4796,7 +4796,7 @@ internal void RemoveModule(PSModuleInfo module, string moduleNameInRemoveModuleC
ProviderInfo pi = pl.Value[i];

// If it was implemented by this module, remove it
string implAssemblyLocation = pi.ImplementingType.GetTypeInfo().Assembly.Location;
string implAssemblyLocation = pi.ImplementingType.Assembly.Location;
if (implAssemblyLocation.Equals(module.Path, StringComparison.OrdinalIgnoreCase))
{
// Remove all drives from the top level session state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private bool ModuleProvidesCurrentSessionDrive(PSModuleInfo module)
Dbg.Assert(pList.Value != null, "There should never be a null list of entries in the provider table");
foreach (ProviderInfo pInfo in pList.Value)
{
string implTypeAssemblyLocation = pInfo.ImplementingType.GetTypeInfo().Assembly.Location;
string implTypeAssemblyLocation = pInfo.ImplementingType.Assembly.Location;
if (implTypeAssemblyLocation.Equals(module.Path, StringComparison.OrdinalIgnoreCase))
{
foreach (PSDriveInfo dInfo in Context.TopLevelSessionState.GetDrivesForProvider(pInfo.FullName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal static bool IsWinRTType(Type type)
// TypeAttributes.WindowsRuntime is part of CLR 4.5. Inorder to build PowerShell for
// CLR 4.0, a string comparison for the for the existence of TypeAttributes.WindowsRuntime
// in the Attributes flag is performed rather than the actual bitwise comparison.
return type.GetTypeInfo().Attributes.ToString().Contains("WindowsRuntime");
return type.Attributes.ToString().Contains("WindowsRuntime");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ private static void VerifyValueType(object value)
{
if (null == value)
{
if (typeof(T).GetTypeInfo().IsValueType)
if (typeof(T).IsValueType)
{
throw PSTraceSource.NewArgumentNullException("value", PSDataBufferStrings.ValueNullReference);
}
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/engine/lang/parserutils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ internal static object ImplicitOp(object lval, object rval, string op, IScriptEx
Type lvalType = lval != null ? lval.GetType() : null;
Type rvalType = rval != null ? rval.GetType() : null;
Type opType;
if (lvalType == null || (lvalType.GetTypeInfo().IsPrimitive))
if (lvalType == null || (lvalType.IsPrimitive))
{
// Prefer the LHS type when looking for the operator, but attempt the right
// the lhs can't have an operator.
Expand All @@ -449,7 +449,7 @@ internal static object ImplicitOp(object lval, object rval, string op, IScriptEx
// would look for overloads in both types, but this logic covers the most common
// cases.

opType = (rvalType == null || rvalType.GetTypeInfo().IsPrimitive) ? null : rvalType;
opType = (rvalType == null || rvalType.IsPrimitive) ? null : rvalType;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ private static T ConvertPropertyValueTo<T>(string propertyName, object propertyV
throw PSTraceSource.NewArgumentNullException("propertyName");
}

if (typeof(T).GetTypeInfo().IsEnum)
if (typeof(T).IsEnum)
{
if (propertyValue is string)
{
Expand Down Expand Up @@ -1698,14 +1698,12 @@ private static T ConvertPropertyValueTo<T>(string propertyName, object propertyV
}
else if (propertyValue == null)
{
TypeInfo typeInfo = typeof(T).GetTypeInfo();

if (!typeInfo.IsValueType)
if (!typeof(T).IsValueType)
{
return default(T);
}

if (typeInfo.IsGenericType && typeof(T).GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
if (typeof(T).IsGenericType && typeof(T).GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
{
return default(T);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static object DecodeClassOrStruct(PSObject psObject, Type type)
/// </summary>
private static bool IsCollection(Type type)
{
return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Collection<>));
return type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Collection<>));
}

private static bool IsGenericIEnumerableOfInt(Type type)
Expand Down Expand Up @@ -155,7 +155,7 @@ private static IList DecodeCollection(PSObject psObject, Type collectionType)
/// </summary>
private static bool IsDictionary(Type type)
{
return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Dictionary<,>));
return type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Dictionary<,>));
}

/// <summary>
Expand Down Expand Up @@ -335,7 +335,7 @@ internal static object EncodeObject(object obj)
{
return obj;
}
else if (type.GetTypeInfo().IsEnum)
else if (type.IsEnum)
{
return (int)obj;
}
Expand Down Expand Up @@ -449,7 +449,7 @@ internal static object DecodeObject(object obj, Type type)
}
return cred;
}
else if (obj is int && type.GetTypeInfo().IsEnum)
else if (obj is int && type.IsEnum)
{
return Enum.ToObject(type, (int)obj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ public virtual string GetResourceString(string baseName, string resourceId)

ResourceManager manager =
ResourceManagerCache.GetResourceManager(
this.GetType().GetTypeInfo().Assembly,
this.GetType().Assembly,
baseName);

string retValue = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ internal static void ReadRegistryInfo(out Version assemblyVersion, out string pu
// the assemblies is patched. ie., all monad assemblies should have the
// same version number.

Assembly currentAssembly = typeof(PSSnapInReader).GetTypeInfo().Assembly;
Assembly currentAssembly = typeof(PSSnapInReader).Assembly;
assemblyVersion = currentAssembly.GetName().Version;
byte[] publicTokens = currentAssembly.GetName().GetPublicKeyToken();
if (publicTokens.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void CreateErrorRecord()
// no useful information anyway.
if (!String.IsNullOrEmpty(_PSSnapin) && !String.IsNullOrEmpty(_reason))
{
Assembly currentAssembly = typeof(PSSnapInException).GetTypeInfo().Assembly;
Assembly currentAssembly = typeof(PSSnapInException).Assembly;

if (_warning)
{
Expand Down
6 changes: 3 additions & 3 deletions src/System.Management.Automation/utils/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ internal static bool IsNumeric(this Type type)

internal static bool IsNumericOrPrimitive(this Type type)
{
return type.GetTypeInfo().IsPrimitive || LanguagePrimitives.IsNumeric(LanguagePrimitives.GetTypeCode(type));
return type.IsPrimitive || LanguagePrimitives.IsNumeric(LanguagePrimitives.GetTypeCode(type));
}

internal static bool IsSafePrimitive(this Type type)
{
return type.GetTypeInfo().IsPrimitive && (type != typeof(IntPtr)) && (type != typeof(UIntPtr));
return type.IsPrimitive && (type != typeof(IntPtr)) && (type != typeof(UIntPtr));
}

internal static bool IsFloating(this Type type)
Expand All @@ -126,7 +126,7 @@ internal static TypeCode GetTypeCode(this Type type)
internal static IEnumerable<T> GetCustomAttributes<T>(this Type type, bool inherit)
where T : Attribute
{
return from attr in type.GetTypeInfo().GetCustomAttributes(typeof(T), inherit)
return from attr in type.GetCustomAttributes(typeof(T), inherit)
where attr is T
select (T)attr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static TelemetryWrapper()
// We build against CLR4.5 so we can run on Win7/Win8, but we want to use apis added to CLR 4.6.
// So we use reflection, and if that fails, we just silently skip logging our telemetry.

var diagnosticsTracingAssembly = typeof(EventSource).GetTypeInfo().Assembly;
var diagnosticsTracingAssembly = typeof(EventSource).Assembly;

Type eventSourceSettingsType = diagnosticsTracingAssembly.GetType("System.Diagnostics.Tracing.EventSourceSettings");
if (eventSourceSettingsType == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private bool ShouldLog(PSLevel level, PSKeyword keywords, PSChannel channel)
{
if (object.ReferenceEquals(_resourceManager, null))
{
_resourceManager = new global::System.Resources.ResourceManager("System.Management.Automation.resources.EventResource", typeof(EventResource).GetTypeInfo().Assembly);
_resourceManager = new global::System.Resources.ResourceManager("System.Management.Automation.resources.EventResource", typeof(EventResource).Assembly);
}
return _resourceManager;
}
Expand Down