You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Type from MetaDataLoadContext.LoadFromAssemblyPath(path).GetTypes()
I notice the your IType API is very similar to the Type API but not identical.
And I don't know whether the difference is on purpose but it troubles me they're not quite interchangeable.
For reference, here's my record into which I load the property values:
Here's my initializing that from your IType instance
static TypeId Transform(thisITypetype){varelementType=(type as TypeWithElementType)?.ElementType ??type;varnameSuffix=(type as TypeWithElementType)?.NameSuffix ??string.Empty;varassemblyName= elementType.GetDefinition()?.ParentModule?.AssemblyName;// want a name like "KeyValuePair`2[]" (i.e. with generic arity appended) and not just "KeyValuePair[]"varname= elementType.GetDefinition()?.MetadataName ?? type.Name;// we have the name of the element not the type, so add the suffixname+=nameSuffix;returnnew TypeId(
assemblyName,
type.Namespace ==string.Empty ?null: type.Namespace,
name,
type.TypeArguments.Select(Transform).ToArrayOrNull(),
type.DeclaringType?.Transform());}
In summary the differences I've found so far (after only one day of test-and-debugging) are as follows.
The AssemblyName when the type is an array -- you correctly (i.e. same as Type) display the name e.g. Foo[], and the namespace (of Foo), but not the name of the assembly from which Foo is loaded -- so instead I must fetch that from your ElementType property.
The Namespace, when there isn't one -- you return an empty string, Type returns null.
Whether the name of the type is e.g. KeyValuePair or KeyValuePair2`
The text was updated successfully, but these errors were encountered:
I'm viewing type information in two ways:
IType
from theICSharpCode.Decompiler
APIsType
fromMetaDataLoadContext.LoadFromAssemblyPath(path).GetTypes()
I notice the your
IType
API is very similar to theType
API but not identical.And I don't know whether the difference is on purpose but it troubles me they're not quite interchangeable.
For reference, here's my record into which I load the property values:
Here's my initializing that from a System.Reflection.Type instance
Here's my initializing that from your IType instance
In summary the differences I've found so far (after only one day of test-and-debugging) are as follows.
Type
) display the name e.g.Foo[]
, and the namespace (ofFoo
), but not the name of the assembly from which Foo is loaded -- so instead I must fetch that from your ElementType property.Type
returns null.KeyValuePair
orKeyValuePair
2`The text was updated successfully, but these errors were encountered: