internal static Attribute GetCustomAttribute(int token, RuntimeModule scope) { int num = 0; int sizeConst = 0; string text = null; string marshalCookie = null; string text2 = null; int iidParamIndex = 0; ConstArray fieldMarshal = ModuleHandle.GetMetadataImport(scope.GetNativeHandle()).GetFieldMarshal(token); if (fieldMarshal.Length == 0) { return(null); } UnmanagedType val; VarEnum safeArraySubType; UnmanagedType arraySubType; MetadataImport.GetMarshalAs(fieldMarshal, out val, out safeArraySubType, out text2, out arraySubType, out num, out sizeConst, out text, out marshalCookie, out iidParamIndex); RuntimeType safeArrayUserDefinedSubType = (text2 == null || text2.Length == 0) ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(text2, scope); RuntimeType marshalTypeRef = null; try { marshalTypeRef = ((text == null) ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(text, scope)); } catch (TypeLoadException) { } return(new MarshalAsAttribute(val, safeArraySubType, safeArrayUserDefinedSubType, arraySubType, (short)num, sizeConst, text, marshalTypeRef, marshalCookie, iidParamIndex)); }
internal static Attribute GetCustomAttribute(int token, RuntimeModule scope) { int sizeParamIndex = 0; int sizeConst = 0; string marshalType = (string)null; string marshalCookie = (string)null; string safeArrayUserDefinedSubType1 = (string)null; int iidParamIndex = 0; ConstArray fieldMarshal = ModuleHandle.GetMetadataImport(scope.GetNativeHandle()).GetFieldMarshal(token); if (fieldMarshal.Length == 0) { return((Attribute)null); } UnmanagedType unmanagedType; VarEnum safeArraySubType; UnmanagedType arraySubType; MetadataImport.GetMarshalAs(fieldMarshal, out unmanagedType, out safeArraySubType, out safeArrayUserDefinedSubType1, out arraySubType, out sizeParamIndex, out sizeConst, out marshalType, out marshalCookie, out iidParamIndex); RuntimeType safeArrayUserDefinedSubType2 = safeArrayUserDefinedSubType1 == null || safeArrayUserDefinedSubType1.Length == 0 ? (RuntimeType)null : RuntimeTypeHandle.GetTypeByNameUsingCARules(safeArrayUserDefinedSubType1, scope); RuntimeType marshalTypeRef = (RuntimeType)null; try { marshalTypeRef = marshalType == null ? (RuntimeType)null : RuntimeTypeHandle.GetTypeByNameUsingCARules(marshalType, scope); } catch (TypeLoadException ex) { } return((Attribute) new MarshalAsAttribute(unmanagedType, safeArraySubType, safeArrayUserDefinedSubType2, arraySubType, (short)sizeParamIndex, sizeConst, marshalType, marshalTypeRef, marshalCookie, iidParamIndex)); }
internal static Attribute GetCustomAttribute(int token, RuntimeModule scope) { UnmanagedType type; UnmanagedType type2; VarEnum enum2; int sizeParamIndex = 0; int sizeConst = 0; string marshalType = null; string marshalCookie = null; string safeArrayUserDefinedSubType = null; int iidParamIndex = 0; ConstArray fieldMarshal = ModuleHandle.GetMetadataImport(scope.GetNativeHandle()).GetFieldMarshal(token); if (fieldMarshal.Length == 0) { return(null); } MetadataImport.GetMarshalAs(fieldMarshal, out type, out enum2, out safeArrayUserDefinedSubType, out type2, out sizeParamIndex, out sizeConst, out marshalType, out marshalCookie, out iidParamIndex); RuntimeType type3 = ((safeArrayUserDefinedSubType == null) || (safeArrayUserDefinedSubType.Length == 0)) ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(safeArrayUserDefinedSubType, scope); RuntimeType marshalTypeRef = null; try { marshalTypeRef = (marshalType == null) ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(marshalType, scope); } catch (TypeLoadException) { } return(new MarshalAsAttribute(type, enum2, type3, type2, (short)sizeParamIndex, sizeConst, marshalType, marshalTypeRef, marshalCookie, iidParamIndex)); }
// Token: 0x06004439 RID: 17465 RVA: 0x000FA620 File Offset: 0x000F8820 private static RuntimeType ResolveType(RuntimeModule scope, string typeName) { RuntimeType typeByNameUsingCARules = RuntimeTypeHandle.GetTypeByNameUsingCARules(typeName, scope); if (typeByNameUsingCARules == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_CATypeResolutionFailed"), typeName)); } return(typeByNameUsingCARules); }
private static RuntimeType ResolveType(RuntimeModule scope, string typeName) { RuntimeType nameUsingCaRules = RuntimeTypeHandle.GetTypeByNameUsingCARules(typeName, scope); // ISSUE: variable of the null type __Null local = null; if (!(nameUsingCaRules == (RuntimeType)local)) { return(nameUsingCaRules); } throw new InvalidOperationException(string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_CATypeResolutionFailed"), (object)typeName)); }
internal static Attribute GetCustomAttribute(int token, Module scope) { UnmanagedType unmanagedType, arraySubType; VarEnum safeArraySubType; int sizeParamIndex = 0, sizeConst = 0; string marshalTypeName = null, marshalCookie = null, safeArrayUserDefinedTypeName = null; int iidParamIndex = 0; ConstArray nativeType = scope.ModuleHandle.GetMetadataImport().GetFieldMarshal(token); if (nativeType.Length == 0) { return(null); } MetadataImport.GetMarshalAs(nativeType, out unmanagedType, out safeArraySubType, out safeArrayUserDefinedTypeName, out arraySubType, out sizeParamIndex, out sizeConst, out marshalTypeName, out marshalCookie, out iidParamIndex); Type safeArrayUserDefinedType = safeArrayUserDefinedTypeName == null || safeArrayUserDefinedTypeName.Length == 0 ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(safeArrayUserDefinedTypeName, scope); Type marshalTypeRef = null; try { marshalTypeRef = marshalTypeName == null ? null : RuntimeTypeHandle.GetTypeByNameUsingCARules(marshalTypeName, scope); } catch (System.TypeLoadException) { // The user may have supplied a bad type name string causing this TypeLoadException // Regardless, we return the bad type name ASSERT.CONSISTENCY_CHECK(marshalTypeName != null); } return(new MarshalAsAttribute( unmanagedType, safeArraySubType, safeArrayUserDefinedType, arraySubType, (short)sizeParamIndex, sizeConst, marshalTypeName, marshalTypeRef, marshalCookie, iidParamIndex)); }