I'm trying to determine a parameters default value and getting a strange error.
I get the below erorr when calling info.HasDefaultValue
Does anyone know how this is done?
Public Sub New(ByVal factory As DefinitionFactory, ByVal info As ParameterInfo)
m_factory = factory
Try
If info.HasDefaultValue Then
Me.DefaultValue = info.DefaultValue.GetType().FullName
End If
Me.HasDefaultValue = info.HasDefaultValue
Catch ioe As InvalidOperationException
End Try
End Sub
Error:
System.InvalidOperationException
HResult=0x80131509
Message=It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.
Source=mscorlib
StackTrace:
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
at System.Reflection.RuntimeParameterInfo.GetDefaultValueInternal(Boolean raw)
at System.Reflection.RuntimeParameterInfo.get_HasDefaultValue()
at DefinitionParameter..ctor(DefinitionFactory factory, ParameterInfo info) in G:\Dev\FrozenElephant\APIcodeDB\ApiCodeModel\DefinitionParameter.vb:line 69
Aucun commentaire:
Enregistrer un commentaire